ThemeShaper Forums » Thematic

[closed]

Replace "Continue Reading" link with page title for SEO

(4 posts)
  • Started 3 years ago by elderberry
  • Latest reply from elderberry
  • This topic is not resolved

Tags:

  1. elderberry
    Member

    Hi All,

    I've been using this function from Helgatheviking (thanks!), but I would like to see the link text read the destination page (or post) title instead of "Continue Reading. I am a php cut 'n paster :-( Tips?

    // excerpt read more links and wrap excerpt in p tag
    function all_excerpts_get_more_link($post_excerpt) {
    	if ( has_post_thumbnail() ) {
    		$child_excerpt =  the_post_thumbnail( 'thumbnail' ) . '<p>' . $post_excerpt . '</p>' . '<p class="readmore"><a href="'. get_permalink($post->ID) . '">' . 'Continue Reading &raquo' . '</a></p>';
    	}
    	else {
    		$child_excerpt = '<p>' . $post_excerpt . '</p>' . '<p class="readmore"><a href="'. get_permalink($post->ID) . '">' . 'Continue Reading &raquo' . '</a></p>';
    	}
    	return $child_excerpt;
     }
    
    add_filter('wp_trim_excerpt', 'all_excerpts_get_more_link');
    Posted 3 years ago #
  2. yeah, instead of 'Continue Reading &raquo' which is missing a ; (so it should be 'Continue Reading »' replace that with the WordPress function the_title() which gets the post title when you are in a loop.

    so

    'Continue Reading ' . the_title() . '»'

    Posted 3 years ago #
  3. elderberry
    Member

    Great - that's perfect.

    Posted 3 years ago #
  4. elderberry
    Member

    Finally Implemented this but it doesn't work - is there something I missed?

    //that wraps the thumbnails w/ the permalink... and to use it you just need to put the_post_thumbnail( 'thumbnail' ) into the excerpt
    // excerpt read more links and wrap excerpt in p tag
    function all_excerpts_get_more_link($post_excerpt) {
    	if ( has_post_thumbnail() ) {
    		$child_excerpt =  the_post_thumbnail( 'thumbnail' ) . '<p>' . $post_excerpt . ' <span class="readmore"><a href="'. get_permalink($post->ID) . '">' . 'Continue reading' . the_title() . '&raquo;' . '</a></span></p>';
    	}
    	else {
    		$child_excerpt = '<p>' . $post_excerpt . ' <span class="readmore"><a href="'. get_permalink($post->ID) . '">' . 'Continue reading' . the_title() . '&raquo;' . '</a></span></p>';
    	}
    	return $child_excerpt;
     }
    add_filter('wp_trim_excerpt', 'all_excerpts_get_more_link');
    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.