[Support request] Rename previous and next links on single blog post

Home Forums Support [Support request] Rename previous and next links on single blog post

Home Forums Support Rename previous and next links on single blog post

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #2080576
    Tesco

    Hi,

    I’m trying to rename the '<' and '>' arrows in single blog posts to: '«« previous blog post' and 'next blog post »»'

    add_filter( 'generate_previous_link_text', function() {
    	return '«« previous blog post';
    } );
    
    add_filter( 'generate_next_link_text', function() {
    	return 'next blog post »»';
    } );

    I’m using the code above on my child theme functions but is not working…

    Note: Child theme is correctly implemented and there is several functions and filters functioning from there.

    Please help!

    #2080588
    Leo
    Staff
    Customer Support

    Hi there,

    Would you consider using this method?
    https://docs.generatepress.com/article/block-element-post-navigation/

    Let me know 🙂

    #2080591
    Tesco

    Maybe… But why is this filter not working for me?

    Ideally I would prefer to use a simple filter on functions.php and styling as I want

    #2080969
    David
    Staff
    Customer Support

    Hi there,

    can you share a link to where its ‘not’ working ?

    #2081104
    Tesco

    here it is!

    #2081107
    David
    Staff
    Customer Support

    Try this:

    add_filter( 'generate_post_navigation_args', function( $args ) {
        if ( is_single() ) {
    
            $args['previous_format'] = '<div class="nav-previous"><span class="prev" title="' . esc_attr__( '«« previous blog post', 'generatepress' ) . '">%link</span></div>';
            $args['next_format'] = '<div class="nav-next"><span class="next" title="' . esc_attr__( 'next blog post »»', 'generatepress' ) . '">%link</span></div>';
        }
    
        return $args;
    } );
    #2081111
    Tesco

    Works!

    Thanks!

    #2081124
    David
    Staff
    Customer Support

    Glad to hear that

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