Site logo

Archived topic

More-Tag doesn’t deliver text

8 replies · Started by Frank on November 26, 2020

Viewing posts 1–9 of 9

<!--more--> works fine, but <!--more Weiterlesen--> doesn’t, it’s just ignored!
The page I need help with: https://www.horst-groschopp.de/category/video/
Look at the last two post. The second to the last has the tag <!--more Weiterlesen-->, the last is a copy of that post with the tag <!--more-->.
How to fix that?

Hi there,

Right now we have an option to add your own global more text that overwrites this feature in WP.

You can tell GP to get out of the way and use the custom text like this:

add_action( 'wp', function() {
    remove_filter( 'the_content_more_link', 'generate_blog_content_more', 15 );
    remove_filter( 'the_content_more_link', 'generate_content_more' );
} );

add_filter( 'generate_more_tag', function( $more ) {
    global $post;

    if ( strpos( $post->post_content, '<!--more' ) ) {
        $more = true;
    }

    return $more;
} );

Will see if we can implement this into the theme itself :)

Thanks Tom.
Where exactly do I put this?

I didn't ask how, but where. I suppose it is the functions.php

I added it in the functions.php starting at line 74 and it works. Thanks a bunch.

Hi there,

that document explains how and where should add the snippets:

1. Is in Child Themes functions.php
More info here on adding a Child Theme:
https://docs.generatepress.com/article/using-child-theme/

2. Install the Code Snippets plugin and add a new snippet.

What you must NOT do is make edits to the Parent Themes function files.
When a Theme is updated, it replaces all the theme files, which means your changes will be lost.

Well thanks.
I updated the function.php of the theme, because I understood, that Tom will correct this bug in the next version, so that nothing will get lost. ;-)

I would still suggest you keep the changes within a child theme or code snippets.
Tom doesn't state it's a definite change that will happen in the next update.

Making updates to the theme requires a lot of considerations, such as will the change affect the 100's thousands of other sites running on GP? Or will we need to 'prepare' the theme for a specific update - it may be we need to change other code before a change like this can be implemented.

This archived topic is closed to new replies.