WordPress.org

Support

Support » How-To and Troubleshooting » How to Display Thumbnail for all post from a Category?

How to Display Thumbnail for all post from a Category?

  • I’m Using a theme, and have a block in home page with Catgory and number of post can opiton on theme cpanel, but this only display thumbnail for last post of Category. Please help me can show thumbnail for all post

    <?php
    	$count=1;
    	$args = array(
    	  'post__not_in'=>$do_not_duplicate,
    	  'posts_per_page' => $numberofposts,
    	  'cat' => get_option('of_nw_cat_name7')
    	);
    	$gab_query = new WP_Query();$gab_query->query($args);
    	while ($gab_query->have_posts()) : $gab_query->the_post();
    	?>
    			<?php if (($count == 1) and (get_option('of_nw_cat_name7')  <> "")) { ?>
    				<span class="titleCatName">
    					<a href="<?php echo get_category_link(get_option('of_nw_cat_name7'));?>"><?php echo get_cat_name(get_option('of_nw_cat_name7')); ?></a>
    				</span>
    			<?php } ?>
    		<div class="featuredPost<?php if ($count == $numberofposts) { echo " lastPost"; } ?>">
    
    			<h2 class="postTitle"><a href="<?php the_permalink() ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'newspro' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    
    			<?php if ($count <= get_option('of_nw_post_count7')) { ?>
    				<?php
    					gab_media(array(
    						'name' => 'gab_featured',
    						'enable_video' => 'true',
    						'video_id' => 'btab1',
    						'catch_image' => get_option('of_nw_catch_img'),
    						'enable_thumb' => 'true',
    						'resize_type' => 'c',
    						'media_width' => '50',
    						'media_height' => '50',
    						'thumb_align' => 'featured_thumb',
    						'enable_default' => get_option('of_nw_enfea8'),
    						'default_name' => 'below_tabs_left.jpg'
    					));
    				?>
    
    				<p>
    
    					<?php if(get_option('of_nw_post_author') == 'true') { ?>
    						<span class="author"><?php the_author_posts_link(); ?></span>
    					<?php } ?>
    
    					<?php if(get_option('of_nw_post_date') == 'true') { ?>
    						<span class="date"><?php echo get_the_time(''); ?> | </span>
    					<?php } ?>
    
    					<?php echo string_limit_words(get_the_excerpt(), 15); ?>&hellip;
    				</p>
    			<?php } ?>
    
    		</div>
    	<?php $count++; endwhile; wp_reset_query(); ?>
    <?php } ?>	
    
    <?php dynamic_sidebar('BelowTabsLeft2');  if(get_option('of_nw_widget') == 'true') { echo '<span class="widgetname">BelowTabsLeft2</span>'; } ?>
    </div>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘How to Display Thumbnail for all post from a Category?’ is closed to new replies.