Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter cath77

    (@cath77)

    Hi

    I have put up my site the link to it is
    http://www.ispysurf.com

    You will be able to see on the post thumbnails that all the category images are being assigned to every post regardless of what categories were actually selected.

    This has something to do with the code in the loop. Any ideas how to fix it?

    Thanks C

    <div class="content-container loop-container">
    
    	<?php if ( have_posts() ) : ?>
    
    		<div class="wrapper">
    
    			<?php /* Start the Loop */ ?>
    			<?php while ( have_posts() ) : the_post(); ?>
    
    				<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    					<a href="<?php the_permalink() ?>"><h2 class="entry-title"><span>
    						<?php echo get_the_title() ? get_the_title() : __('Untitled', 'focus') ?>
    
    					</span></h2></a>
    
               <strong> <?php foreach (get_categories() as $cat) : ?>        
    
     <div class=cat_images>
    
     <img src="<?php echo z_taxonomy_image_url($cat->term_id); ?>" />
     <a href="<?php echo get_category_link($cat->term_id); ?>"></a>
    
     </div>
     <?php endforeach; ?></strong>
     <div class="clear"></div>
    
      <a href="<?php the_permalink() ?>" class="thumbnail-wrapper">
    						<!-- <div class="time"></div> -->
    						<?php echo has_post_thumbnail() ? get_the_post_thumbnail() : focus_default_post_thumbnail();  ?>
    
    					</a>
    				</article>
    
    			<?php endwhile; ?>
    
    		</div>
    
    	<?php else : ?>
    
    		<?php get_template_part( 'no-results', 'index' ); ?>
    
    	<?php endif; ?>
    
    	<div class="clear"></div>
    
    </div>
    
    <?php focus_content_nav( 'nav-below' ); ?>
    Thread Starter cath77

    (@cath77)

    Hi

    I have put up my site the link to it is
    http://www.ispysurf.com

    You will be able to see on the post thumbnails that all the category images are being assigned to every post regardless of what categories were actually selected.

    This has something to do with the code in the loop. Any ideas how to fix it?

    Thanks C

    <div class="content-container loop-container">
    
    	<?php if ( have_posts() ) : ?>
    
    		<div class="wrapper">
    
    			<?php /* Start the Loop */ ?>
    			<?php while ( have_posts() ) : the_post(); ?>
    
    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    <a href="<?php the_permalink() ?>"><h2 class="entry-title"><span>
    <?php echo get_the_title() ? get_the_title() : __('Untitled', 'focus') ?>
    
    					</span></h2></a>
    
     <?php foreach (get_categories() as $cat) : ?>        
    
     <div class=cat_images>
    
     <img src="<?php echo z_taxonomy_image_url($cat->term_id); ?>" />
     <a href="<?php echo get_category_link($cat->term_id); ?>"></a>
    
     </div>
     <?php endforeach; ?>
     <div class="clear"></div>
    
      <a href="<?php the_permalink() ?>" class="thumbnail-wrapper">
    <!-- <div class="time"></div> -->
    <?php echo has_post_thumbnail() ? get_the_post_thumbnail() : focus_default_post_thumbnail();  ?>
    
    					</a>
    				</article>
    
    			<?php endwhile; ?>
    
    		</div>
    
    	<?php else : ?>
    
    <?php get_template_part( 'no-results', 'index' ); ?>
    
    	<?php endif; ?>
    
    	<div class="clear"></div>
    
    </div>
    
    <?php focus_content_nav( 'nav-below' ); ?>
    Plugin Author Zahlan

    (@elzahlan)

    You have to use get_the_category instead of get_categories function

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Duplicate Categories’ is closed to new replies.