WordPress.org

Support

Support » Themes and Templates » Quark » [Resolved] Change "Continue Reading"

[Resolved] Change "Continue Reading"

  • I want to change the ‘Continue Reading ->’ that appears with the except to ‘read more..’, but I ‘m having a bit of trouble figuring it out. I found the function, but I can’t get it to change in my child theme.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Theme Author Anthony Hortin

    @ahortin

    Hi Nadine,

    If you want to change the “Continue reading” link that is shown when you add a “read more” tag within your content, then you can change this within the content.php template. The the_content() function has a parameter that you pass with the text that you want displayed.

    If you want to change the text for the automatic excerpts that are generated, such as on the search results page. Then add the following functions to your child theme functions.php file.

    function quarkchild_continue_reading_link() {
    	return '&hellip;<p><a class="more-link" href="'. esc_url( get_permalink() ) . '" title="' . esc_html__( 'Continue reading', 'quark' ) . ' &lsquo;' . get_the_title() . '&rsquo;">' . wp_kses( __( 'Read more <span class="meta-nav">&rarr;</span>', 'quark' ), array( 'span' => array(
    			'class' => array() ) ) ) . '</a></p>';
    }
    
    function quarkchild_auto_excerpt_more( $more ) {
    	return quarkchild_continue_reading_link();
    }
    add_filter( 'excerpt_more', 'quarkchild_auto_excerpt_more', 11 );

    What I’ve done here is duplicated the functions that were in the quark theme that create the “read more” link. I’ve then simply renamed them (so you don’t get any php errors by having duplicate function names) and then used these on the “excerpt_more” filter. I’ve also specified the priority as 11 so that it gets called after the filter in the parent Quark theme (and thereby overriding it).

    Hope this helps 🙂

    Theme Author Anthony Hortin

    @ahortin

    Hi Nadine,

    If you want to change the “Continue reading” link that is shown when you add a “read more” tag within your content, then you can change this within the content.php template. The the_content() function has a parameter that you pass with the text that you want displayed.

    If you want to change the text for the automatic excerpts that are generated, such as on the search results page. Then add the following functions to your child theme functions.php file.

    function quarkchild_continue_reading_link() {
    	return '&hellip;<p><a class="more-link" href="'. esc_url( get_permalink() ) . '" title="' . esc_html__( 'Continue reading', 'quark' ) . ' &lsquo;' . get_the_title() . '&rsquo;">' . wp_kses( __( 'Read more <span class="meta-nav">&rarr;</span>', 'quark' ), array( 'span' => array(
    			'class' => array() ) ) ) . '</a></p>';
    }
    
    function quarkchild_auto_excerpt_more( $more ) {
    	return quarkchild_continue_reading_link();
    }
    add_filter( 'excerpt_more', 'quarkchild_auto_excerpt_more', 11 );

    What I’ve done here is duplicated the functions that were in the quark theme that create the “read more” link. I’ve then simply renamed them (so you don’t get any php errors by having duplicate function names) and then used these on the “excerpt_more” filter. I’ve also specified the priority as 11 so that it gets called after the filter in the parent Quark theme (and thereby overriding it).

    Hope this helps 🙂

    Theme Author Anthony Hortin

    @ahortin

    Excuse the duplicate posts. Not sure what happened there.

    thanks so much, the function did the trick!

    Theme Author Anthony Hortin

    @ahortin

    Glad it helped 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] Change "Continue Reading"’ is closed to new replies.
Skip to toolbar