WordPress.org

Ready to get started?Download WordPress

Forums

Problem with Next and Previous Links (4 posts)

  1. coolkarthik88
    Member
    Posted 6 years ago #

    i am using a modified version of the grid focus theme.. here is my index.php code. please help me.. I am not able to display the prev posts and next posts on the search pages etc.. a similar code is also there in home.php

    <?php get_header(); ?>
    <div id="mid" class="fix">
    <div id="mainCol" class="fix">
    <?php if (have_posts()) : ?>
    <?php $top_query = new WP_Query('showposts=2');?>
    <?php while($top_query->have_posts()) : $top_query->the_post(); ?>
    <div class="post" id="post-<?php the_ID(); ?>">
    <div class="postMeta"><span class="date"><?php the_time('M j, Y') ?></span><span class="comments"><?php comments_popup_link('0', '1', '%'); ?></span></div>
    <h2>" title="<?php the_title(); ?>"><?php the_title() ?></h2>
    <div class="entry">
    <p><?php the_content('Read more...'); ?></p>
    </div>
    </div>
    <?php endwhile; ?>
    <?php else : ?>
    <div class="post">
    <div class="postMeta"><span class="date">No Matches</span></div>
    <h2>No matching results</h2>
    <div class="entry">
    <p>You seem to have found a mis-linked page or search query with no associated results. Please trying your search again. If you feel that you should be staring at something a little more concrete, feel free to email the author of this site or browse the archives.</p>
    </div>
    </div>
    <?php endif; ?>
    <div id="more_reading">
    <p>Continue <?php posts_nav_link(' ','<img src="http://dailyapps.net/wp-content/themes/grid_focus_public/images/arrow_prev.gif" alt="Previous page"/>','<img src="http://dailyapps.net/wp-content/themes/grid_focus_public/images/arrow_next.gif" alt="Next page" />') ?></p>
    </div>
    
    </div>
    <?php include (TEMPLATEPATH . '/sidebar.php'); ?>
    </div>
    <?php get_footer(); ?>
  2. garryconn
    Member
    Posted 6 years ago #

    It doesn't appear to have the naviation code included. You can try adding this:

    <div class="navigation">
    <div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div>
    <div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div>
    </div>

    This code came direct from WP 2.2.1 default search.php file.

  3. coolkarthik88
    Member
    Posted 6 years ago #

    and what about the posts_nav_link function. can it not be used..

  4. garryconn
    Member
    Posted 6 years ago #

    I have no idea. The code I gave you should be included in the search.php file.

    After re-reading your post I am guessing you are having trouble with your index.php file?

    You said:

    "I am not able to display the prev posts and next posts on the search pages etc."

    So, the above code I gave you would display the "Next Entries" and "Previous Entries" on any section you want it displayed on. It should be found in your index.php, search.php as well as single.php file... possibly even a few others, but I can't think of them off hand.

    If you can't navigate to next and previous pages, then to me that's a problem. I have downloaded the theme you are referring to and I am not very familiar with it. I tend to stay very close to the default theme in regards to coding. There are tons of themes out there the cause people to run into trouble just like you are experiencing. As I had mentioned above, try adding that code into your index.php file and if it doesn't work, then remove it and ask the creator of the theme for help. This isn't a WordPress issue it is a design issue.

    Sorry I couldn't be of more help.

Topic Closed

This topic has been closed to new replies.

About this Topic