CMS Scripts

Add links on your articles before and after


This is a small fragment useful to use if you use the previous and next links in your articles. It will enhance the links showing the name of the actual post, encouraging more people to click on the links.
File to edit: single.php

 

2
3
4
5
6
7
<?php
$p = get_adjacent_post(false, , true);
if(!empty($p)) echo ‘<div class=”prev”><a href=”‘ . get_permalink($p->ID) . ‘” title=”‘ . $p->post_title . ‘”>’ . $p->post_title . ‘</a></div>’;
$n = get_adjacent_post(false, , false);
if(!empty($n)) echo ‘<div class=”next”><a href=”‘ . get_permalink($n->ID) . ‘” title=”‘ . $n->post_title . ‘”>’ . $n->post_title . ‘</a></div>’;
?>

1 Comment

Leave a Reply