WordPress.org

Ready to get started?Download WordPress

Forums

The Bootstrap
[resolved] Change the read more tag in child theme (5 posts)

  1. stemie
    Member
    Posted 1 year ago #

    Hi,

    I tried the following but it doesnt change the read more tag from 'continue reading' to 'more' as I hoped.

    Any chance someone can point me in the right direction?

    function spost_continue_reading_link() {
    	return ' <a href="'. esc_url( get_permalink() ) . '">' . __( 'More <span class="meta-nav">&rarr;</span>', 'the-bootstrap' ) . '</a>';
    }
    add_filter( 'the_bootstrap_continue_reading_link', 'spost_continue_reading_link' );
  2. jmjf
    Member
    Posted 1 year ago #

    Check out http://wordpress.org/support/topic/removing-the-excerpt-continue-reading-link?replies=8

    The goal there was to remove the link, but you can modify the last echo in function the_excerpt_max_charlength($charlength) in my last post there to spit out a permalink with whatever you want it to say. If you don't care about the other excerpt functionality, you can strip that down to whatever you need.

  3. stemie
    Member
    Posted 1 year ago #

    Sorry but I'm still stuck :(
    Probably doing something really silly...
    I cant seem to get it to show my custom more tag?

    function remove_excerpt_more_link() {
    	remove_filter( 'get_the_excerpt', 'the_bootstrap_custom_excerpt_more' );
        remove_filter( 'excerpt_more', 'the_bootstrap_auto_excerpt_more' );
    	 }
    add_action( 'after_setup_theme', 'remove_excerpt_more_link' );
    
    function spost_continue_reading_link() {
    	return ' <a href="'. esc_url( get_permalink() ) . '">' . __( 'More <span class="meta-nav">&rarr;</span>', 'the-bootstrap' ) . '</a>';
    }
    add_filter( 'the_bootstrap_continue_reading_link', 'spost_continue_reading_link' );
  4. jmjf
    Member
    Posted 1 year ago #

    I don't have a clear understanding of exactly what's going on, but I'll share what I know.

    In the-bootstrap, partials/content.php calls the_excerpt() to get the excerpt for an entry (but only for searches). The codex says the_excerpt will include [...] but doesn't include a read more link.

    I wrote a customized partials/content.php that always called the_excerpt(). Everything I tried to remove the link was unsuccessful until I wrote my own excerpt function (see last post in thread linked earlier) and called it instead of the_excerpt(). Other people on that thread were able to get the remove filter calls to work. Your mileage may vary.

    While I was experimenting with excerpts, I found that calling the_excerpt() and adding a read more link would result in a double read more link, so it seems something is going in the-bootstrap to add the read more link, but I haven't been able to track it down. I needed to customize a copy of partials/content.php (with a different name) anyway because that's the only way I could find to force excerpts in a list on my home page, which I want to keep reasonably short (by default, the-bootstrap only shows excerpts for searches).

    Maybe there's a better way to do it, but that's what I found that works. Maybe post on that thread and someone there will have more help.

  5. stemie
    Member
    Posted 1 year ago #

    Thanks jmjf for your help.
    I will try some of your suggestions.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic