WordPress.org

Support

Support » How-To and Troubleshooting » Link to untitled entries in next/previous navigation

Link to untitled entries in next/previous navigation

  • My template currently has the following code:

    <p><?php previous_post('&laquo; %', '', 'yes'); ?> :: <?php next_post('% &raquo;', '', 'yes'); ?></p>

    This display as :

    « Previous post title :: Next post title »

    where “Previous post title” and “Next post title” are the actual links to the single entry page itself.

    But I have many entries which are UNTITLED — so no link appears!

    I’ve been trying to find a way to make it so that if there’s no title, then use some text, such as “(untitled)” as the link itself.

    I can’t seem to find anything in the Codex that allows you to do this. Anyone know if there’s a plugin or piece of code I don’t know about yet?

Viewing 1 replies (of 1 total)
  • With your settings, there is only the « displayed … without link. You can put in ‘Next: ‘ (or something like that) into second parameter, so it will be displayed as part of the link, if there is no title, it’s the link.

    You can do it other ways, but then you have to do the previous/next functionality by yourself. Not recommended.

    Hope that helped, take a look at http://codex.wordpress.org/Template_Tags/previous_post

Viewing 1 replies (of 1 total)
  • The topic ‘Link to untitled entries in next/previous navigation’ is closed to new replies.