• Anybody help me out and know how to add a span to the following code so ‘$next_post->post_title’ and ‘$prev_post->post_title’ are also wrapped in span tags? Thanks!

    add_filter( ‘astra_single_post_navigation’, ‘astra_change_next_prev_text’ ); /** * Function to change the Next Post/ Previous post text. * * @param array $args Arguments for next post / previous post links. * @return array */ function astra_change_next_prev_text( $args ) { $next_post = get_next_post(); $prev_post = get_previous_post(); $next_text = false; if ( $next_post ) { $next_text = sprintf( ‘%s <span class=”ast-right-arrow”>→</span>’, $next_post->post_title ); } $prev_text = false; if ( $prev_post ) { $prev_text = sprintf( ‘<span class=”ast-left-arrow”>←</span> %s’, $prev_post->post_title ); } $args[‘next_text’] = $next_text; $args[‘prev_text’] = $prev_text; return $args; }

    original source: https://wpastra.com/docs/replace-navigation-strings-on-single-post/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Add span to Replace default navigation strings with next/previous post titles?’ is closed to new replies.