[Resolved] More-Tag doesn’t deliver text

Home Forums Support [Resolved] More-Tag doesn’t deliver text

Home Forums Support More-Tag doesn’t deliver text

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1550644
    Frank

    <!--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?

    #1550668
    Tom
    Lead Developer
    Lead Developer

    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 🙂

    #1550766
    Frank

    Thanks Tom.
    Where exactly do I put this?

    #1550947
    Elvin
    Staff
    Customer Support

    Hi Frank,

    What Tom provided is a PHP snippet.

    Here’s how to add PHP snippets – https://docs.generatepress.com/article/adding-php/

    #1551347
    Frank

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

    #1551406
    Frank

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

    #1551679
    David
    Staff
    Customer Support

    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.

    #1551708
    Frank

    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. 😉

    #1551771
    David
    Staff
    Customer Support

    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.

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.