Article updated 4 February 2020 at 5 h 47 me

 

Article Navigation in WorPress 2 buttons.
Edit WordPress for better navigation between your articles.

A first example below desous to separate our WordPress Form navigation menu.
Editing performed on single.php or template-single.php (depending on the themes chosen this differs configuration).

<div align="left" class="boutonleft"><?php previous_post_link( '%link', '&larr; %title'); ?></div>
<div align="right" class="boutonright"><?php next_post_link( '%link', '%title &rarr;'); ?></div>

 

And now see how to integrate a special character (HTML entity) in our WordPress articles navigation menu.
previous Article:

<?php $prevPost = get_previous_post(false);
if($prevPost) {
$args = array(
'posts_per_page' => 1,
'include' => $prevPost->ID
);echo "\t" . '<a rel="prev" href="' . get_permalink($prev_post->ID) . '" title="' . $prev_title. '" class="previous-post"><h4><span class="icone">&larr;</span>PREVIOUS POST</h4></a>' . "\n";
$prevPost = get_posts($args);
foreach ($prevPost as $post) {
setup_postdata($post);
?>
<?php
wp_reset_postdata();
} //end foreach
} // end if
?>

 

 

next article:

<?php $nextPost = get_next_post(false);
if($nextPost) {
$args = array(
'posts_per_page' => 1,
'include' => $nextPost->ID
);echo "\t" . '<a rel="next" href="' . get_permalink($next_post->ID) . '" title="' . $next_title. '" class="next-post"><h4>NEXT POST<span class="icone">&rarr;</span></h4></a>' . "\n";
$nextPost = get_posts($args);
foreach ($nextPost as $post) {
setup_postdata($post);
?>
<?php
wp_reset_postdata();
} //end foreach
} // end if
?>


0
0.0 rating
0 / 5 stars (0 view)
Excellent0%
Very good0%
Average0%
Poor0%
Horrible0%

Cancel

 

Rate this article

Leave a Reply

Your email address will not be published. Required fields are marked *