Jump to content
Sign in to follow this  
zouleo

Replace the [Continue Reading...] text with a button with custom text

Recommended Posts

zouleo

According to the docs it should be possible to replace the [Continue Reading...] text on the excerpt using the excerpt_more filter. But it doesn't work. I've also tried the the_content_more_link filter. But no luck. When using the code below excerpts ends with:

... ?» [Continue Reading...][/code]

	
	
[code] function custom_excerpt_more() { global $post; return ' ... »'; } add_filter('excerpt_more', 'custom_excerpt_more');

What am I doing wrong? (yes, I know I can change the text in the admin interface, but I want to change more than text. In the end I want a button instead of a text link)

Share this post


Link to post
Share on other sites
zouleo

Yes. I want to use the buttons from Twitter Bootstrap. Like this:

function custom_excerpt_more() {
	    global $post;
		$review = get_post_meta($post->ID, 'is-review', true);
		if ($review) {
			return 'Read review'
		} else {
			return 'Read post'
		}
	}
	add_filter('excerpt_more', 'custom_excerpt_more');
	[/code]

Any ideas of what I'm doing wrong?

Share this post


Link to post
Share on other sites
zouleo

I solved it. I was using the wrong filter. This is the correct filter: continue_reading_link

Share this post


Link to post
Share on other sites
James B

@zouleo glad you got this resolved, I've accepted your answer to close this topic. If you want to discuss this topic further you can still post and enter comments on this thread.


Kindly search the forum and read the documentation before posting. It will help you resolve many issues.

For CSS help be sure to check out W3Schools first and be sure to download FireBug for FireFox for troubleshooting.

James B

Share this post


Link to post
Share on other sites
beardedavenger

CSS only solution:

#page a.continue_reading_link {
	  display: inline-block;
	  .ie7-inline-block();
	  padding: 4px 10px 4px;
	  margin-bottom: 0; // For input.btn
	  font-size: @buttonFontSize;
	  font-family: @buttonFontFamily;
	  line-height: @baseLineHeight - 1;
	  color: @white;
	  text-align: center;
	  text-shadow: 0 -1px 0 rgba(0,0,0,.25);
	  vertical-align: middle;
	  border: 1px solid @btnBorder;
	  .border-radius(4px);
	  @shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);
	  .box-shadow(@shadow);
	  cursor: pointer;
	  .buttonBackground(@btnPrimaryBackground, @btnPrimaryBackgroundHighlight);
	
	&:hover {
	text-shadow: 0 -1px 0 rgba(0,0,0,.25);
	@shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);
	color: @white;
	text-decoration: none;
	background-color: darken(@white, 10%);
	border: 1px solid @btnBorder;
	}
	
	&:active {
	color: rgba(255,255,255,.75);
	}
	}


Something big is coming for DMS + photographers.

http://fotostheme.com

 

Nick Haskins & CO - New home for all of my PageLines Store products! 

http://nickhaskins.co

 

Better DMS - News, Tutorials, and Tips

http://betterdms.com

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×