Support » Plugins » Linking to Previous / Next Post?

Viewing 15 replies - 1 through 15 (of 21 total)
  • You can always look at the WordPress Default theme’s wp-content/themes/default/single.php to see how it uses the previous_post_link and next_post_link.

    Ah… so you can just pull that code from another theme? I’ve messed with it in other themes but it’s total absence in this theme had me wondering if it could be added. Many thanks. 🙂

    Hm… so where are all these functions located, like cfct_single()? Can’t find them in the theme editor.

    cfct_single is not a native WordPress function so must be a function specfic to your theme (or a plugin), so use WinGrep to search your wp-contents folder for that string.

    I use a Mac. I’ll do a search in BBEdit, though.

    Okay, maybe I’m dense… but I am getting a bit of a run-around from all these files. Any chance someone could do this for me, or share the code you’ve used yourself to do this? I would think this is a pretty important thing, linking to previous / next posts, so that people can go through your content easily.

    *ding dong*

    I switched back to iNove while I wait for an answer on this – I like Carrington more but the previous/next thing is important to me and I can’t figure it out.

    Anyone…? *crickets chirping*

    Is this what you are looking for?

    Here’s some code for ya, put it in Single.php (your theme’s single post template)

    <div class="navigation">
    <?php previous_post_link('%link', '<img src="http://YOURSITE.COM/YOUR-PREVIOUS-POST-REWIND-ARROW-BUTTON.jpg"/> <strong>View the previous post!</strong>'); ?> 
    ------ Divide them how you want or make a new DIV ------ 
    <?php next_post_link('%link', '<strong>View the next post!</strong> <img src="http://YOURSITE.COM/YOUR-NEXT-POST-FORWARD-ARROW-BUTTON.jpg"/>'); ?></div>

    Or try this and mess around with it,

    <?php previous_post_link('&laquo %link', '%title'); ?>
    <?php next_post_link('%link &raquo', '%title'); ?>


    Try adding this code just below the start of the loop.

    <?php if ($single) { ?>
    <?php } ?>
    <?php previous_post_link('%link'); ?><a href="<?php echo bloginfo('url'); ?>/index.php"> | Main | </a><?php next_post_link('%link'); ?>

    figaro: yes, that’s precisely what i’m looking for with the previous/next links at the top. how’d you do it? and any clue how i could link to related posts above the comments?

    jabecker: what file are you referring to for putting that code in? (I tried putting it in loop-default.php, after the while loop started, after the end of the loop, and in a couple other spots, and none of those worked.

    The code that jabecker listed is the same basic code, similar method, as the code I listed. Mine included a way for you to put NEXT and PREVIOUS images (jpeg arrows back and forth) if you wish.

    jabecker’s added the conditional statement for “if single page”, which means you could plop it into your Main Index Template (probably index.php) if you do not have a Single.php.

    Mine was meant to put in Single.php — so you would not need a conditional statement like that.

    Give it a try. You have these templates in your theme?

    Go here and downlod the file in the latest post. I put directions in the post for you.

Viewing 15 replies - 1 through 15 (of 21 total)
  • The topic ‘Linking to Previous / Next Post?’ is closed to new replies.