Forums

[resolved] Showing previous page and next page with same link (22 posts)

  1. jinsenkaredath
    Member
    Posted 2 years ago #

    Hi I am using pixeled theme. Now when you come to my index page (www.j-k.in, at the bottom you will find 'Next Page' & 'Previous Entries', but the link for both is same (http://j-k.in/blog/page/2/) if you click on 'next page' you will get 4 links at bottom, I want to remove the 'next page' link from my index page. Could anyone help me to do it.
    Thanks in advance
    Jinsen Karedath

  2. Christian Schenk
    Member
    Posted 2 years ago #

    In the admin area of your blog go to "Appearance - Editor" and open the file index.php. Search for a call to next_posts_link and use conditional tags so that the link doesn't appear on the home page.

    Example:

    <?php if (is_home()) next_posts_link(); ?>

  3. imranexpt
    Member
    Posted 2 years ago #

    I think it should be !is_home() instead of is_home()

    <?php if (!is_home()):
     next_posts_link();
      endif;
    ?>

    He wants to remove the link on index page.

  4. Christian Schenk
    Member
    Posted 2 years ago #

    Sure! Thanks for the code review ;)

  5. Mark / t31os
    Moderator
    Posted 2 years ago #

    Might be more cautious to check if it's the front page at the same time to...
    <?php if (!is_home() || !is_front_page()) next_posts_link(); ?>

    There's no need to span such a simple piece of code over 4 lines either imranexpt... nor a requirement for : and endif... (just preferential coding practices)..

  6. jinsenkaredath
    Member
    Posted 2 years ago #

    Thanks every one for the reply, but I could not find 'next_posts_link'. this is the code:

    <div id="nextprevious">
    <div class="alignleft"><?php posts_nav_link('','','« PREVIOUS ENTRIES') ?></div>
    <div class="alignright"><?php posts_nav_link('','NEXT ENTRIES »','') ?></div>
    <div class="cleared"></div>

    and if you go to my second page it is mentioned
    'Previous page' 'previous entries' 'next entries' 'next page'
    I need only 'Previous Page' in the index page and 'previous page' and 'next page' link in the inner pages according to number of pages.

    Please Can someone visit my site and give me a solution: http://www.j-k.in
    Thanks

  7. jinsenkaredath
    Member
    Posted 2 years ago #

    forgot to mention: I have recenlty upgraded wordpress to 2.8 whether it has some missmatch with the earlier version of pixeled?

  8. Christian Schenk
    Member
    Posted 2 years ago #

    OT, but... @t31os:

    You can link to your site in your profile

    I don't really bother but I've done that and my site isn't showing up just like on imranexpt's profile page. Nor is my name - on this page - turned into a link. Must have to do with a user's activity, right? No posts, no love?

  9. Christian Schenk
    Member
    Posted 2 years ago #

    Try replacing the two lines from the code above with the following:

    <div class="alignleft"><?php previous_posts_link(); ?></div>
    <div class="alignright"><?php next_posts_link(); ?></div>

    You can read more about the functions here and there if you want to.

  10. Mark / t31os
    Moderator
    Posted 2 years ago #

    http://codex.wordpress.org/Template_Tags/posts_nav_link#Examples

    Look for something like this in your file (your's may look slightly different of course).

    <?php next_posts_link('&laquo; Previous posts');echo ' ';previous_posts_link('Newer posts &raquo;');?>

    Those functions create the Next/Previous post links... as oppose to the page next/prev links...

  11. Mark / t31os
    Moderator
    Posted 2 years ago #

    To add chschenk, i think you got it the wrong way round, that's the one's he wants to remove... ;)

    Regarding profile linkage, i posted a test thread in the misc forum from a fresh account, and yes it does appear new accounts don't link...

    Strange, you've been here longer then me, yet i have active links on 2 profiles... :-s

  12. jinsenkaredath
    Member
    Posted 2 years ago #

    chschenk:
    Thanks, its working, the problem is for previous page it says next page and aligned at the right side

  13. jinsenkaredath
    Member
    Posted 2 years ago #

    t31os_
    Thanks, is there any way to correct it?

  14. Mark / t31os
    Moderator
    Posted 2 years ago #

    Can you elaborate on what you want to do a bit more?

    If you currently have...

    <div id="nextprevious">
    <div class="alignleft"><?php posts_nav_link('','','« PREVIOUS ENTRIES') ?></div>
    <div class="alignright"><?php posts_nav_link('','NEXT ENTRIES »','') ?></div>
    <div class="cleared"></div>

    You will naturally get 2 links, 1 left and 1 to the right...

    class="alignleft" , floats elements to the left..
    class="alignright" , floats elements to the right..

    Please clarify exactly how you want it to behave...

    NOTE: if you want to get rid of the single/per post Prev/Next links, then remove the next_posts_link() and previous_posts_link() calls.

  15. jinsenkaredath
    Member
    Posted 2 years ago #

    Thanks all:

    I got it... just changed the code and it is working...

    thanks for your time :)

    Jinsen Karedath

  16. jinsenkaredath
    Member
    Posted 2 years ago #

    t31os_:

    thanks I made it

  17. Mark / t31os
    Moderator
    Posted 2 years ago #

    Cool... Virtual cookies all round!! :)

  18. J3551C4
    Member
    Posted 2 years ago #

    @jinsenkaredath what did you change? im having the same exact problem, i want to get rid of the extra next page , previous page links and keep the next entries previous entries links and cannot figure out what I need to change in order ot make the next|previous page links disappear.

    thanks in advance.

  19. J3551C4
    Member
    Posted 2 years ago #

    Just saw what you did. You created actual links to specific pages which will only navigate to the pages you specified.

    Still trying to figure this out.

    On my home page, at the bottom of the home entries, you will see two links:

    « PREVIOUS ENTRIES Next Page »

    If you click on either one of these, you will then see this on the next page:

    <<previous page <<previous entries next entries>> previous page>>

    I know where the code is for the previous/next entries, and that is the one I want to keep. What i don't know is where the next/previous page links are coming from, and how to delete them. *Sighs* any help will be greatly appreciated.

    I have my url on my info as well but my username isnt linked, and my website link is not displayed.

  20. J3551C4
    Member
    Posted 2 years ago #

    k i dont know what im talking about...he did fix it, and i cant figure out how lol =]

  21. pacaveli420
    Member
    Posted 2 years ago #

    I changed the code to:

    <div id="nextprevious">
    <div class="alignleft"><?php previous_posts_link() ?></div>
    <div class="alignright"><?php next_posts_link() ?></div>
    <div class="cleared"></div>
    </div>

    <?php posts_nav_link is what the code originally was
    this calls both next and previous links
    and so you end up with two on each side

  22. ashaman
    Member
    Posted 2 years ago #

    Hi, I followed the instructions mentioned above and the links work perfectly on the frontpage. Although, when you visit a category or click on a tag, the same double links appear.
    Is there something I can do that affects that behaviour as well?
    Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.