• Hello, i need a help that a homepage has hidden posts from different categories, this page displays 5 posts per page with only one category, but there 3 posts were displayed… i’m pretty sure when 2 posts from different category bothers the index.php…

    How to remove hidden posts in index.php?

    Here a snippet:

    <?php get_header(); ?>
    <div id="fronter"></div>
    <div id="lines"></div>
    <div id="slider_area">
    <div id="wrapsli">
    <div id="lefts">
    </div>
    <div id="slider_on">
    
        </div>
    </div>
    <div id="rights">
    </div>
    </div>
    </div>
    <div id="lines"></div>
    <div id="wrap">
    
    		<div class="col1">
    
    		    <?php
    		    if (is_paged()) $is_paged = true;
    
    		     $paged = (get_query_var('paged')) ? get_query_var('paged') : 0;
                 $args = array(
                   'post__not_in' => $shownslides,
                   'tag__not_in' => $tagids,
                   'paged'=> $paged
                   );
                 query_posts($args);
    
    		     $home_content = get_option('woo_home_content');
    		     $home_boxes = get_option('woo_home_boxes');
    
    			 if (have_posts()) : 
    
    		     $full = FALSE;
    
    		     $width = get_option('woo_full_thumb_width');
    		     $height = get_option('woo_full_thumb_height');
    
    		     if( $home_boxes == 'On') { $small = TRUE; }
    		     elseif ($home_boxes == 'Off') { $full = TRUE; }
    		     else {  $large_posts = intval($home_boxes); }
    
    		     $counter = 0;
    			 while (have_posts()) : the_post();
    		        $counter++;
    		        $post_class = 'full';
    		        if( ($counter > $large_posts OR $small == TRUE) AND $full ==  FALSE)
    		        {
    		            $width = get_option('woo_boxed_thumb_width');
    		            $height = get_option('woo_boxed_thumb_height');
    		            if( $small == FALSE ) $counter = 1;
    		            $small = true;
    		                if ($counter%2 == 0 ) { $post_class = 'fr';  }
    		                else { $post_class = 'fl'; }
    		        }
    
    		     ?>	
    
     <?php if ( in_category('1') ) { ?>
    
    			<div class="post-outer post <?php echo $post_class; ?>">
    
    			    <div class="post-inner post-alt">       
    
    					<h2><a title="<?php _e('Permalink to ',woothemes); ?><?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    					<div id="titus">
    		            <span class="title-meta"><span class="udate">publicado // </span><span class="date"><?php the_time('d F Y'); ?></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="udate">autor // </span><span class="date"><?php the_author();?></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="udate">categor&iacute;a // </span><span class="date"><?php the_category('category_name');?></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="udate">comentarios //</span><span class="date"><?php comments_popup_link(__(' 0',woothemes), __(' 1',woothemes), __(' %',woothemes)); ?></span> </span>
    					</div>
    		            	<div style="clear:both;"></div>
    		            <?php if ($home_content == 'false') { ?>
    
    					    <p><?php echo strip_tags(get_the_excerpt(), '<a><strong>'); ?></p>
    						<?php woo_get_image('image',$width,$height); ?>
    						<br />
    						<div id="last">
    					    <a class="more-link" title="<?php _e('Permalink to ',woothemes); ?><?php the_title(); ?>" href="<?php the_permalink() ?>"><?php _e('SEGUIR LEYENDO &raquo;',woothemes); ?></a>
    			        <?php } else { ?>
    		                <?php the_content(__('Continue Reading',woothemes)); ?>
    		            <?php } ?>
    					</div>
    
    			        </div><!--/post-inner-->
    				</div><!--/post-->
    
    			    <?php if ($counter%2 == 0 AND $small == TRUE ) { echo '<div style="clear:both;"></div>'; } ?>
    		         <?php } ?>
    			<?php endwhile; ?>
    		    <?php endif; ?>
    						    <div class="fix"></div>
    		    <div class="more_entries">
    		        <?php if (function_exists('wp_pagenavi')) wp_pagenavi(); else { ?>
    		            <div class="fl"><?php previous_posts_link(__('&laquo; Newer Entries ',woothemes)) ?></div>
    		            <div class="fr"><?php next_posts_link(__(' Older Entries &raquo;',woothemes)) ?></div>
    		            <br class="fix" />
    		        <?php } ?>
    		    </div>
    		    <div class="fix"></div>
    
    		</div><!--/col1-->
    		</div>
    		</div>
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

    You see this <?php if ( in_category(‘1’) ) { ?> maybe it should to add some codes.

    my regards!

  • The topic ‘Remove hidden posts from different Categories in index.php’ is closed to new replies.