Forums

[resolved] Page Navigation not working after exclude some categories... Please Help Me... (4 posts)

  1. sngsl
    Member
    Posted 1 year ago #

    Hi guys...

    in my site page navigation not working. when click on previous button show me the same page (home page)

    i was to exclude some categories from front page then i used

    <?php
       if (is_home()) {
          query_posts("cat=-14,-16");
       }
    ?>

    Without this page navigation works perfectly...

    however i need to exclude these categories from front page..

    Do i need to add some codes to index.php here is the index.php

    <?php get_header(); ?>

    <div id="content">

    <?php
    if (is_home()) {
    query_posts("cat=-14,-16");
    }
    ?>

    <?php if (have_posts()) : ?>

    <?php while (have_posts()) : the_post(); ?>

    <div class="post" id="post-<?php the_ID(); ?>">

    <h2>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></h2>

    <div class="cover">

    <div class="entry">

    <?php the_excerpt();?>

    #comments"><?php comments_popup_link(__(''), __(''), __('')); ?>

    </div>

    </div>

    <div class="postmetadata">

    </div>
    </div>

    <?php endwhile; ?>

    <div class="navigation">
    <div class="alignleft"><?php next_posts_link('« Older Entries') ?></div>
    <div class="alignright"><?php previous_posts_link('Newer Entries »') ?></div>
    </div>

    <?php else : ?>

    <h2 class="center">Not Found</h2>
    <p class="center">Sorry, but you are looking for something that isn't here.</p>
    <?php get_search_form(); ?>

    <?php endif; ?>

    </div>

    <?php get_sidebar(); ?>

    <?php get_footer(); ?>

    Please help me to solve this problem...

    Thanx

  2. Shane G.
    Member
    Posted 1 year ago #

    Hi,

    Refer this article for the exclude/include categories:

    http://codex.wordpress.org/Template_Tags/wp_list_categories#Include_or_Exclude_Categories

    After that use this plugin for navigation:

    http://wordpress.org/extend/plugins/wordpress-navigation-list-plugin-navt/

    Thanks,

    Shane G.

  3. sngsl
    Member
    Posted 1 year ago #

    Problem Solved after replace

    <?php query_posts($query_string . '&cat=-14,-16'); ?>

    to

    <?php
    if (is_home()) {
    query_posts("cat=-14,-16");
    }
    ?>

    Thanx

  4. sngsl
    Member
    Posted 1 year ago #

    Hi guys,

    My problem solved after

    replace

    <?php
    if (is_home()) {
    query_posts("cat=-14,-16");
    }
    ?>

    To

    <?php query_posts($query_string . '&cat=-14,-16'); ?>

    Thanx

Topic Closed

This topic has been closed to new replies.

About this Topic