WordPress.org

Ready to get started?Download WordPress

Forums

query_posts with pagenavi (4 posts)

  1. sume
    Member
    Posted 1 year ago #

    My web page page3 and over aren't working

    i added my theme 2 new Custom Post Type. you can see it's pic here

    my index.php is include that code:

    <?php get_header(); ?>
    
    	 <?php
    		//Get value from Admin Panel
    		$cp_categories = get_categories('hide_empty=0');
            $status1 = get_option( "colabs_preventHeadline" );
            if ( $status1 != "No" ) {
                $ar_headline = get_option( "colabs_headline" );
                $ar_featured = get_option( "colabs_featured" );
            }
            ?>
    
    	<div id="bottom" class="clearfloat">
    
    	<div class="<?php if(get_option('colabs_layout_settings')=='two-col-right'){echo 'right';}else{?>left<?php }?>">
    
    	<?php if(!is_paged() && 1 == 2) { ?>	
    
    	<div id="front-list">	
    
    	<?php
    
    		$args = array(
    			'category__not_in' => array($ar_headline,$ar_featured),
    			'showposts' => 1,
    		);
    
    		query_posts($args); ?>
    
    	<?php while (have_posts()) : the_post(); ?>
        <?php global $ar_ID; global $post; $ar_ID[] = $post->ID; ?>
    
    	<div class="clearfloat">
    	<h3 class="cat_title"><?php the_category(', '); ?> »</h3>
    	<h2 class="title"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
        <?php colabs_post_meta(); ?>
        <?php
    		$latest_thumb=get_option('colabs_latest_post_thumb');
    		if($latest_thumb!='No'){
    		$width = get_option ( "colabs_thumbWidth_LatestPost" );
    		$height = get_option ( "colabs_thumbHeight_LatestPost" );
    		if ( $width == 0 ) { $width = 150; }
    		if ( $height == 0 ) { $height = 150; }
            colabs_pp('width='.$width.'&height='.$height.'&size=medium-thumb&play=true&wrapper_class=left&link=img');
    		}
    	?>
    
    	<?php //the_content(__('Read the full story »','colabsthemes')); ?>
    	<?php the_excerpt(); ?>
    	</div>
    
          	<?php endwhile; ?>
    	<?php wp_reset_query(); ?>
    
    	</div><!--/#front-list-->
    
    	<?php } ?>
    
        <?php add_filter('post_limits', 'my_post_limit'); ?>
    
        <?php
    		global $myOffset;
    		$myOffset = 0;
    		$temp = $wp_query;
            $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    
    		//echo 'SINGLEPOST:';
    		$singlePost = get_query_var('singlePost');
    
    		$wp_query= null;
    		$wp_query = new WP_Query();
    		$wp_query->query(array(
                    'paged' => $paged,
    				'offset' => $myOffset,
    				'category__not_in' => array($ar_headline,$ar_featured),
                    'post__not_in' => get_option( 'sticky_posts' ),
                    'ignore_sticky_posts' => 1,
                    'post_type' => !$singlePost ? array('post','haberler','otopsiler') : array('post'),
    				)); 
    
    		?>
    
    	<?php $column = get_option ( "colabs_status_Column" );
    		if ( $column != "one" ) { ?>	
    
    	<div id="paged-list">	
    
    		<?php if (have_posts()) : ?>
    		<?php $i = 1; ?>
    
    		<?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
            <?php global $ar_ID; global $post; $ar_ID[] = $post->ID; ?>
    
    	<?php if( $odd = $i%2 ) { echo '<div class="clearfloat">'; } ?>
    
    	<div class="tanbox <?php if( $odd = $i%2 ) { echo 'left'; } else { echo 'right'; } ?>">
            <h3 class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
        <?php
            colabs_post_meta();
    
            $width = get_option ( "colabs_thumbWidth_Column" );
    		$height = get_option ( "colabs_thumbHeight_Column" );
    		if ( $width == 0 ) { $width = 80; }
    		if ( $height == 0 ) { $height = 80; }
            colabs_pp('width='.$width.'&height='.$height.'&size=small-thumb&play=true&wrapper_class=left&link=img');
        ?>
    
    		<?php $status = get_option ( "colabs_excerptColumn" );		if ( $status != "no" ) { ?>
    		<?php the_excerpt(); ?>
    		<?php } ?>
    	</div>
    
    	<?php if( $odd = $i%2 ) { } else { echo '</div>'; } ?>
    
          <?php $i++; endwhile; ?>
    
    	<?php if( $odd = $i%2 ) { } else { echo '</div>'; } ?>
    
    	<div id="navigation">
    	<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>
    
    	</div>
    
    	<?php endif; ?>
    	</div><!--/#paged-list-->
    
    	<?php } else { ?>
    
    	<div id="paged-list">	
    
    		<?php if (have_posts()) : ?>
    
    		<?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
    	    <?php global $ar_ID; global $post; $ar_ID[] = $post->ID; ?>
    
    		<div class="onecolumn clearfloat">
    
             <h3 class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
    	<?php
            colabs_post_meta();
            echo "<!-- /HEREEEEEEE -->";
    
            $width = get_option ( "colabs_thumbWidth_Column" );
    		$height = get_option ( "colabs_thumbHeight_Column" );
    		if ( $width == 0 ) { $width = 80; }
    		if ( $height == 0 ) { $height = 80; }
            colabs_pp('width='.$width.'&height='.$height.'&size=small-thumb&play=true&wrapper_class=left&link=img');
        ?>
    
    		<?php $status = get_option ( "colabs_excerptColumn" );		if ( $status != "no" ) { ?>
    		<?php the_excerpt(); ?>
    		<?php } ?>
    		</div>
    
          	<?php endwhile; ?>
    
    		<div id="navigation">
    		<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?></div>
    
    		<?php endif; ?>
    
    	</div><!--/#paged-list-->
    
    	<?php } ?>	
    
    	<?php $wp_query = null; $wp_query = $temp;?>
    	<?php remove_filter('post_limits', 'my_post_limit'); ?>
    
    	</div><!--/#bottom-left-->
    	<div id="sidebar" class="<?php if(get_option('colabs_layout_settings')=='two-col-right'){echo 'left';}else{?>right<?php }?>">
    	<?php get_sidebar(); ?>
    	</div><!--/#bottom-->
    
    <?php get_footer(); ?>

    i'm using arthemia theme. I added only that code:

    //echo 'SINGLEPOST:';
    		$singlePost = get_query_var('singlePost');
    
    ..................
    
    'post_type' => !$singlePost ? array('post','haberler','otopsiler') : array('post'),

    Any ideas? Thanks

  2. simplistik
    Member
    Posted 1 year ago #

    because you're using a custom query loop you need to use this method:
    http://scribu.net/wordpress/wp-pagenavi/wpn-2-74.html

    in that template looks like you just need to do

    <?php if ( function_exists('wp_pagenavi') ) wp_pagenavi(array('query' => $wp_query)); ?>
  3. sume
    Member
    Posted 1 year ago #

    thanks for your help i added this code but still it isn't working.

    i looked scribu but my index.php codes are different so i can't do it.

    any ideas?

  4. sume
    Member
    Posted 1 year ago #

    i have tried all things but is isn't working

Topic Closed

This topic has been closed to new replies.

About this Topic