[Support request] Need to add aria-label=”blog” to the post nav…

Home Forums Support [Support request] Need to add aria-label=”blog” to the post nav…

Home Forums Support Need to add aria-label=”blog” to the post nav…

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1538305
    Alicia

    Is there a filter?

    #1538345
    Elvin
    Staff
    Customer Support

    Hi,

    To clarify: do you want to add this attribute on single post’s post nav buttons (prev/next)?

    If so, here’s a PHP snippet for it.

    add_filter( 'generate_post_navigation_args', function( $args ) {
        if ( is_single() ) {
    
            $args['previous_format'] = '<div class="nav-previous">' . generate_get_svg_icon( 'arrow-left' ) . '<span class="prev" title="' . esc_attr__( 'Previous', 'generatepress' ) . '">%link</span></div>';
            $args['next_format'] = '<div class="nav-next">' . generate_get_svg_icon( 'arrow-right' ) . '<span class="next" title="' . esc_attr__( 'Next', 'generatepress' ) . '">%link</span></div>';
        }
    
        return $args;
    } );

    Add your aria-label="blog" to the $arg['previous_format'] & $args['next_format'] markup.

    A wise man once said:
    "Have you cleared your cache?"

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