• Resolved pokern24org

    (@pokern24org)


    So far I’ve made the change to the more tag via functions.php. Now I wanted to try out the Code Snippets plugin, which is also recommended by you. Unfortunately, that doesn’t work.

    If I enter the following in functions.php, everything is displayed as I want it.

    function modify_read_more_link() {
      return '<a class="r-link link text-underlined" href="' . get_permalink() . '">Mehr lesen</a>';
    }
    add_filter( 'the_content_more_link', 'modify_read_more_link' ); 

    If I enter the whole thing in the code snippet plugin, I have the old more tag again, which I don’t want.

    Maybe I made a mistake and changed the theme to 2019 as a test. It works fine there. Where am I making the mistake?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi there,

    Make sure you’ve removed the same filter on the functions.php when you added that on the code snippets plugin. Else, it’ll cause filter conflict.

    I’m not exactly sure what you’re trying to do though.

    To clarify: Are you trying to change the “Read More” button on the blog page and archive pages?

    If that’s the case, you may have to use either of these 2 filters.
    https://docs.generatepress.com/article/generate_content_more_link_output/
    https://docs.generatepress.com/article/generate_excerpt_more_output/

    Let us know if this is the case. ??

    Thread Starter pokern24org

    (@pokern24org)

    Thank you, now it works.

    I took the following code.

    add_filter( 'generate_content_more_link_output','tu_change_content_more_link' );
    function tu_change_content_more_link() {
        return sprintf( '<p class="read-more-container MY-CUSTOM-CLASS"><a title="%1$s" class="r-link link text-underlined" href="%2$s">%3$s</a></p>',
            the_title_attribute( 'echo=0' ),
            esc_url( get_permalink( get_the_ID() ) . apply_filters( 'generate_more_jump','#more-' . get_the_ID() ) ),
            __( 'Mehr erfahren', 'generatepress' )
        );
    }

    The only strange thing is that I already tried this out yesterday and it didn’t work.

    The only strange thing is that I already tried this out yesterday and it didn’t work.

    Perhaps it wasn’t saved? I’m not really sure as I can’t check that to confirm.

    Glad you got it sorted. No problem. ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Change the more-tag’ is closed to new replies.