Support » Plugin: WP-PageNavi » Works in category but not on index

  • The navigation works on category section, but it doesn’t work on the homepage. It stays the same.

    Here’s the code:

    <h2 class="page-title"></h2>
                <?php $theme->hook('content_before'); ?>
    <?php query_posts('cat=6&showposts=2&offset=1'); ?>
                    $is_post_wrap = 0;
                        if (have_posts()) : while (have_posts()) : the_post();
                         * The default post formatting from the post.php template file will be used.
                         * If you want to customize the post formatting for your homepage:
                         *   - Create a new file: post-homepage.php
                         *   - Copy/Paste the content of post.php to post-homepage.php
                         *   - Edit and customize the post-homepage.php file for your needs.
                         * Learn more about the get_template_part() function:
                            if($is_post_wrap == '1') {
                                ?><div class="post-wrap clearfix"><?php
                            get_template_part('post', 'homepage');
                            if($is_post_wrap == '2') {
                                $is_post_wrap = 0;
     style="border: 0px solid ; width: 327px; height: 132px;" alt="self improvement blog"
     style="border: 0px solid ; width: 327px; height: 132px;" alt="self improvement videos"
                    else :
                        get_template_part('post', 'noresults');
                        if($is_post_wrap == '1') {
                <?php $theme->hook('content_after'); ?>
            </div><!-- #content -->
            <?php get_sidebars(); ?>
            <?php $theme->hook('main_after'); ?>
        </div><!-- #main -->

    I think it has to do with this code here <?php query_posts('cat=6&showposts=2&offset=1'); ?>

    I implemented this code in order to exclude a category and ever since then, goign to page 2, 3, and etc all stays the same.

    my website is

    Appreciate any help that I can get!

Viewing 11 replies - 1 through 11 (of 11 total)
  • Michael


    Forum Moderator

    the ‘offset’ parameter in a query does not work with pagination;

    try to find a different way to exclude the first post.

    implemented this code in order to exclude a category


    what is the reason for the ‘offset’?

    I implemented the offset so that it doesn’t show the latest post.

    No idea what I should replace offset with, but since you said it’s the perpetrator, then that must be the problem.

    Bumping to see if anyone can help me, sorry!



    Forum Moderator

    try and change this line:

    <?php query_posts('cat=6&showposts=2&offset=1'); ?>


    <?php $latest = get_posts('cat=6&posts_per_page=1');
    query_posts( array( 'cat' => 6, 'posts_per_page' => 2, 'paged' => get_query_var('paged'), 'post__not_in' => array( $latest[0]->ID ) ) ); ?>


    might make problems with pagination if the dashboard – settings – reading – blog pages show at most [ ] posts is not set to 2 as well

    Thank you for your help!

    Unfortunately this still doesn’t work as the navigation page still displays the same thing on each page.



    Forum Moderator

    try and replace:

    I tried replacing that but it’s still displaying the same thing.



    Forum Moderator

    what is the full code of the template?
    (please use the pastebin – see )



    Forum Moderator

    your first loop (with just one post) is messing with the ‘paged’ parameter; at least try to add wp_reset_query(); after teh first loop.

    generally, you could use only one single loop to show all posts and the first post in a different format; try the forum search if you can find some suggestions.

    please post here again if the simple fix does not work.

    I want to thank you “alchymyth” for your help.

    Im not a webdesigner and do not understand a bit about code. I just want to adapt a theme to my needs…. Thata why I looked for help in this forum.
    I didnt get the answer I nedded in my topic (which bytheway was closed by you “alchymyth”), but I got the solution for my problem in this topic.
    It worrked perfectly as I wanted just by adding the code you suggested to “dend359″… and I visited your blogs and became your fan.

    Thank you very much!!!!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Works in category but not on index’ is closed to new replies.