Strict Standards: Redefining already defined constructor for class bbdb in /home/themes/public_html/forums/bb-includes/db-mysql.php on line 12

Strict Standards: Declaration of BB_Walker_Blank::start_lvl() should be compatible with BB_Walker::start_lvl($output) in /home/themes/public_html/forums/bb-includes/classes.php on line 1127

Strict Standards: Declaration of BB_Walker_Blank::end_lvl() should be compatible with BB_Walker::end_lvl($output) in /home/themes/public_html/forums/bb-includes/classes.php on line 1127

Strict Standards: Declaration of BB_Walker_Blank::start_el() should be compatible with BB_Walker::start_el($output) in /home/themes/public_html/forums/bb-includes/classes.php on line 1127

Strict Standards: Declaration of BB_Walker_Blank::end_el() should be compatible with BB_Walker::end_el($output) in /home/themes/public_html/forums/bb-includes/classes.php on line 1127
Read more link in manual excerpt « ThemeShaper Forums

ThemeShaper Forums » Thematic

[closed]

Read more link in manual excerpt

(3 posts)
  • Started 4 years ago by gaillen
  • Latest reply from gaillen
  • This topic is resolved
  1. gaillen
    Member

    Is it possible to auto generate a read more link for manual excerpts?

    I can find lots of information to modify the read more link for auto generated excerpts but actually creating one for manually generated seems to not exist?

    Posted 4 years ago #

  2. Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 440

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 510

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 512


    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 440

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 510

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 512
    em hr

    Moderator

    Hi gaillen-

    I think that the more link behavior of WordPress is more closely tied to building themes with templates than the newer child theme method using filters and actions provided by a theme framework. I still find the excerpt & more-tag variations baffling at times.

    Try this:

    function all_excerpts_get_more_link($post_excerpt) {
    
    	return $post_excerpt . '<a href="'. get_permalink($post->ID) . '">' . 'Read More...' . '</a>';
    }
    add_filter('wp_trim_excerpt', 'all_excerpts_get_more_link');

    You may want to do something with the excerpt_more filter to remove or replace the [...].

    Here are a list of codex pages that may shed some light:

    http://codex.wordpress.org/Customizing_the_Read_More
    http://codex.wordpress.org/Function_Reference/wp_trim_excerpt
    http://codex.wordpress.org/Plugin_API/Filter_Reference/excerpt_more

    -Gene

    Posted 4 years ago #
  3. gaillen
    Member

    Thank you again Gene. That worked and so did the reference to the excerpt more filter. I now have both types of excerpts behaving the same on my posts, categories and archives pages. Much easier to explain to my end user if these all have a consistent behaviour. Now they can choose to manually write the excerpt or let it auto generate with the final product behaving the same for readers in both cases.

    If anyone else is looking for this solution here is the combination in use in my child theme functions.php . Note the addition of a class to the read more permalink to apply CSS styling.

    // Displays excerpt of posts on posts/home page moved to "articles" with static front page
    function childtheme_content($content) {
    	if ( is_home () ) {
    		$content= 'excerpt';}
    	return $content;
    }
    add_filter('thematic_content', 'childtheme_content');
    
    // Custom excerpt length (change the numerical value)
    function new_excerpt_length($length) {
    return 100;
    }
    add_filter('excerpt_length', 'new_excerpt_length');
    
    // Changes the behaviour of manual excerpts to include read more link (note css class)
    function all_excerpts_get_more_link($post_excerpt) {
    
    	return $post_excerpt . '<a href="'. get_permalink($post->ID) . '" class="read-more">' . ' ...continue reading article...' . '</a>';
    }
    add_filter('wp_trim_excerpt', 'all_excerpts_get_more_link');
    
    // Filters [...] from the manual excerpts string
    function new_excerpt_more($more) {
    	return '';
    }
    add_filter('excerpt_more', 'new_excerpt_more');

    -Gaillen

    Posted 4 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.


Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method GA_Filter::spool_analytics() should not be called statically in /home/themes/public_html/forums/bb-includes/wp-functions.php on line 586

Strict Standards: Non-static method GA_Filter::spool_this() should not be called statically in /home/themes/public_html/forums/my-plugins/googleanalytics.php on line 183