Link to untitled entries in next/previous navigation (2 posts)

  1. psychofish
    Posted 10 years ago #

    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?

  2. bob58
    Posted 10 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic