• Resolved ejm

    (@llizard)


    I have just upgraded from 2.9.2 to 3.0.5

    Everything appears to be in order except the previous post/next post links above each post. These links used to appear only on the expanded post and not on the main page. What do I need to change in the coding so these links will show only on the actual post page?

    Here is the coding I have now:

    <!-- start prev/next posts -->
    <div class="pstlnk">
    
    <?php previous_post('<b>&laquo</b> % <b>&laquo</b> ?', '', 'yes'); ?>  <?php next_post('? <b>&raquo</b> % <b>&raquo</b>', '', 'yes'); ?>
    
    </div>
    <!-- end prev/next posts -->

    I hope the question makes sense.

    -EMorris, Firefox 3.6.8, WinXP, WP3.0.5

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter ejm

    (@llizard)

    Just to clarify, I am trying to get the previous post/next post links above each post never to appear on the index page.

    Here is the site: etherwork.net/blog/ ?? I have purposely left that unlinked, in an attempt to keep spammers at bay.

    -E

    Thread Starter ejm

    (@llizard)

    sigh… please excuse me for replying to myself yet again.

    I just noticed that I was using the now deprecated tags previous_post and next_post (https://codex.www.ads-software.com/Function_Reference/previous_post). I have now changed the coding on my index page to read the following – it is within the loop.

    <?php previous_post_link('<b>&laquo</b> %link <b>&laquo</b> &nbsp;'); ?> <?php next_post_link('&nbsp; <b>&raquo</b> %link <b>&raquo</b>'); ?>

    Irritatingly, the links are still showing on the index page.

    Just to reiterate, what must I do to get those links to show ONLY on the post page and not on the main blog page?

    -EMorris, Firefox 3.6.8, WinXP, WP3.0.5

    etherwork.net/blog/ ?? I have purposely left this unlinked, in an attempt to keep spammers at bay.

    Thread Starter ejm

    (@llizard)

    Excuse me for replying to myself yet again. Because I did not receive any replies to my questions, I continued googling and searching. While it might not be the most elegant or perfect solution, I do think it works.

    MichaelH suggested to “edit the single.php” in a reply to the thread Display text on one post and one post only?

    My theme didn’t have a single.php file but now it does. I have removed the following coding from my theme index.php and put it onto the newly formed single.php

    <?php previous_post_link('<b>&laquo</b> %link <b>&laquo</b> &nbsp;'); ?> <?php next_post_link('&nbsp; <b>&raquo</b> %link <b>&raquo</b>'); ?>

    This will work well for now. I’ll stare at the following to see if there is a tidier way. https://codex.www.ads-software.com/Conditional_Tags#A_Single_Post_Page

    -E

    Thread Starter ejm

    (@llizard)

    I looked a little more at https://codex.www.ads-software.com/Function_Reference/previous_post_link and have now altered the coding to the following (I remembered to fix the character entities and make sure they ended with semicolons):

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

    And hey presto, the previous/next post links (with the exception of any links to posts in the #7 category) are showing up only on the actual post pages. Yay!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘previous/next post links’ is closed to new replies.