I'm looking for a way to display the two buttons "previous" and "next" of the navigation of my page, but with the code below, I can only show one. I do not understand what's wrong in the code (below):

<div class="cover--nav">
            $currenttPostId = get_the_ID();
            $theCategory = get_the_terms(get_the_ID(),'recipe_category');

                global $wp_query;

                $args = array(
                    'post_type' => 'recipe',
                    'orderby' => 'rand',
                    'post_status' => 'publish',
                    'recipe_category'=> !empty($theCategory)? $theCategory[0]->slug : '',
                    'post__not_in' => array($currenttPostId), 
                    'posts_per_page' => 2,
                    'paged' => $paged  //very important
                $wp_query = new WP_Query($args);

                $prevNext = array();

                if ( $wp_query->have_posts() ) :
                    while ( $wp_query->have_posts() ) : $wp_query->the_post();


                $prev_label = "<span class='cover--nav-label'>" . _e('Recette précédente', 'marque') . "</span>";

                $prev_arrow = "<svg class='icon icon-arrow-prev' role='presentation' focusable='false'><use xlink:href='" . get_template_directory_uri() . "/images/symbol-defs.svg#icon-arrow-prev'></use></svg>";

                $prev_text = $prev_label . $prev_arrow;

                $next_label = "<span class='cover--nav-label'>" . _e('Recette suivante', 'marque') . "</span>";

                $next_arrow = "<svg class='icon icon-arrow-next' role='presentation' focusable='false'><use xlink:href='" . get_template_directory_uri() . "/images/symbol-defs.svg#icon-arrow-next'></use></svg>";

                $next_text = $next_label . $next_arrow;

                the_posts_navigation( array(
                'prev_text' => $prev_text,
                'next_text' => $next_text,
                ) );



This is what happens:

enter image description here

I would like to get the example below:

enter image description here

1 Answer 1


The _e function immediately echoes the translated content to the output queue, so the string will end up in the html early. If you simply want to retrieve the translated content to add it to a string you need __.

  • hi and thank you for your help, I made the change but the problem persists (I still only the previous button that appears)
    – Frenchy_WP
    Feb 11, 2019 at 8:55
  • In the picture both texts are appearing. It's just the arrow that is missing. So there most likely is something wrong with your css as well.
    – cjbj
    Feb 11, 2019 at 8:59
  • I thought about it too, but when I look at the inspector of my browser, I only have the previous button that appears (I specify that it is the number one picture from which the problem originates, I would like to obtain the result of two buttons as shown in image number two)
    – Frenchy_WP
    Feb 11, 2019 at 9:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.