WordPress.org

Forums

Fashionistas
Customize "Continue Reading →" ?? (6 posts)

  1. doclalor
    Member
    Posted 9 months ago #

    I have tried customizing in a child theme:

    content.php
    inc/extras.php
    lang/_s.pot

    as well as adding to functions.php

    I am unable to figure it out. Does anyone know how to solve this puzzle?

    Thanks!
    ~Brendan

  2. Ali-Usman
    Member
    Posted 8 months ago #

    Hi Brendan,
    You are editing CHILD theme, which is a good habit instead of editing parent themes.

    Yea, here is a way to customize Continue Reading → for FASHIONISTAS theme.

    1- Goto your theme directory (FASHIONISTAS).
    2- Find & open (inc) folder.
    3- open extras.php.
    4- find the following function and replace the Continue Reading → with any TEXT you want.
    function athemes_continue_reading_link() {
    return ' ' . __( 'Continue Reading <span class="meta-nav">→</span>', 'athemes' ) . '';
    }

    This will solve the issue...

    Thanks.

  3. doclalor
    Member
    Posted 8 months ago #

    Right you are. I was editing extras.php in my child theme. I now see that that does not work.

    If that file will not be read in the child theme, is there a way to preserve my function in the functions.php of my child theme?

    This does not work, but perhaps provides an idea:

    function tii_continue_reading_link() {
    	return ' ' . __( '', 'athemes' ) . '';
    }
    
    function child_theme_setup() {
    	// override parent theme's 'more' text for excerpts
    	remove_filter( 'continue_reading_link', 'athemes_continue_reading_link' );
    	add_filter( 'continue_reading_link', 'tii_continue_reading_link' );
    }
    add_action( 'init', 'child_theme_setup' );

    Thanks!

  4. Ali-Usman
    Member
    Posted 8 months ago #

    Hi,
    Here is the working code.If you don't want to change the theme functions.You can use WP remove_filter feature like this:

    function child_theme_setup()
    {
    remove_filter('excerpt_more', 'athemes_custom_excerpt_more');
    }
    add_action('after_setup_theme', 'child_theme_setup');
    
    function custom_excerpt_more($more)
    {
    return '<a class="more-link" href="' . get_permalink() . '">Your Read More Link Text</a>';
    }
    add_filter('excerpt_more', 'custom_excerpt_more');

    This way you will get the CUSTOM Continue Reading text without changing theme functions.

    Thanks...

  5. doclalor
    Member
    Posted 8 months ago #

    Thank you for the effort. I'm afraid that wasn't it.

    I'm talking about the "athemes_continue_reading_link," not the "athemes_custom_excerpt_more".

    I tried to adapt what you've provided to my case, but without success.

    For example, I tried:

    function child_theme_setup()
    {
    remove_filter('continue_reading_link', 'athemes_continue_reading_link');
    }
    add_action('after_setup_theme', 'child_theme_setup');
    
    function custom_excerpt_more($more)
    {
    return '<a class="more-link" href="' . get_permalink() . '">Your Read More Link Text</a>';
    }
    add_filter('continue_reading_link', 'custom_excerpt_more');

    That didn't do it.

  6. Ali-Usman
    Member
    Posted 8 months ago #

    If you don't want to use the athemes_continue_reading_link, then you can remove functions attached with this hook and can write your own function in the child theme as well to ADD it after removing athemes_continue_reading_link.
    This function will create CUSTOM CONTINUE READING with custom function:

    function custom_excerpt_more() {
        return '…<a class="more-link" href="' . get_permalink() . '">CUSTOM READ MORE?</a>';
    }
    
    function my_child_theme_setup() {
        remove_filter( 'excerpt_more', 'athemes_continue_reading_link' );
        add_filter( 'excerpt_more', 'custom_excerpt_more' );
    }
    add_action( 'after_setup_theme', 'my_child_theme_setup' );

    I hope this clears stuff in your mind.Thanks

Reply

You must log in to post.

About this Theme

About this Topic