• Hello everybody,
    I get a problem. When i custom category file as my plan. But i want to show in navigation when to many post. I try to insert <?php wp_pagenavi(); ?> in loop but it not working.

    Can you help me fix this problem. Thanks in advanced.

    <?php $options = get_option(‘theme’); ?>
    <?php get_header(); ?>
    <div id=”page”>
    <div class=”content”>
    <article class=”article”>
    <div id=”content_box”>
    <div class=”mota bonus”>
    <h1 class=”postsby”>
    <?php if (is_category()) { ?>
    <span><?php single_cat_title(); ?></span>
    <?php } elseif (is_tag()) { ?>
    <span><?php single_tag_title(); ?></span>
    <?php } elseif (is_search()) { ?>
    <span><?php _e(“Search Results for:”, “theme”); ?></span> <?php the_search_query(); ?>
    <?php } elseif (is_author()) { ?>
    <span><?php _e(“Author Archive”, “theme”); ?></span>
    <?php } elseif (is_day()) { ?>
    <span><?php _e(“Daily Archive:”, “theme”); ?></span> <?php the_time(‘l, F j, Y’); ?>
    <?php } elseif (is_month()) { ?>
    <span><?php _e(“Monthly Archive:”, “theme); ?>:</span> <?php the_time(‘F Y’); ?>
    <?php } elseif (is_year()) { ?>
    <span><?php _e(“Yearly Archive:”, “theme”); ?>:</span> <?php the_time(‘Y’); ?>
    <?php } ?>
    </h1>
    <?php echo category_description( $category_id ); ?> </div>
    <?php
    $category_id = get_cat_ID(single_cat_title(”, false));
    $args = array(
    ‘posts_per_page’ => 3,
    ‘cat’ => $category_id,
    );
    query_posts($args); // reset to original
    if (have_posts()): ;?>
    <?php while (have_posts()) : the_post(); ?>
    <div style=”width:32%;float:left;padding-left:5px;”><?php if ( has_post_thumbnail() ) { ?>
    <?php echo ‘<div class=”featured-thumbnail”>’; the_post_thumbnail(‘homepage’,array(‘title’ => ”)); echo ‘</div>’; ?>
    <?php } else { ?>
    <div class=”featured-thumbnail”>
    <img width=”200″ height=”110″ src=”<?php echo get_template_directory_uri(); ?>/images/nothumb.png” class=”attachment-featured wp-post-image” alt=”<?php the_title(); ?>”>
    </div>
    <?php } ?>

    <h2 class=”title”>
    ” title=”<?php the_title(); ?>” rel=”bookmark”><?php the_title(); ?>
    </h2>
    <div class=”post-content image-caption-format-1″>
    <?php echo excerpt(15);?> …
    </div>
    </div>
    <?php endwhile; ?>
    <?php query_posts (array(‘offset’=>3, ‘cat’ => $category_id)); ?>
    <?php while (have_posts()) : the_post(); ?>
    <div style=”width:100%, clear:both;float:left”>

    <div class=”hinh-index” style=”width: 25%;float: left;padding: 10px 0px 10px 0px;padding-left:5px;”>
    ” title=”<?php the_title(); ?>” id=”featured-thumbnail-rest”>
    <?php if ( has_post_thumbnail() ) { ?>
    <?php echo ‘<div class=”featured-thumbnail-rest”>’; the_post_thumbnail(‘homepage’,array(‘title’ => ”)); echo ‘</div>’; ?>
    <?php } else { ?>
    <div class=”featured-thumbnail-rest”>
    <img width=”200″ height=”110″ src=”<?php echo get_template_directory_uri(); ?>/images/nothumb.png” class=”attachment-featured wp-post-image” alt=”<?php the_title(); ?>”>
    </div>
    <?php } ?>

    </div><!—endhinh—>
    <div class=”chu-index” style=” width: 70%; float: left;padding-top: 10px “>
    <h2 class=”title”>
    ” title=”<?php the_title(); ?>” rel=”bookmark”><?php the_title(); ?>
    </h2>
    <div class=”post-content image-caption-format-1″>
    <?php echo excerpt(25);?> …
    </div>

    </div><!—endhchu—>

    </div>
    <?php endwhile;?>
    <?php endif; ?>
    <?php wp_pagenavi(); ?>
    <?php wp_reset_query; ?>

    </div>
    </article>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

  • The topic ‘Page navigation not working in two loop’ is closed to new replies.