• Hello

    I’m trying to display four diferent categories in four diferent archives, doing for diferent archives. I’m using is_category but nothing is displayed.

    <div id="primary" class="content-area">
    	<main>
    
    		<?php
    
    			get_template_part("template-parts/content","page");
    
    			$args = array( 'post_type' =>portfolio, );
    			$query = new WP_Query( $args ); 
    
    			if ( $query->have_posts()) : while ( $query->have_posts() ) : $query->the_post();
    
    				if(is_category("imatge-coorporativa")):
    
    				$image = get_field('imagen');
    
    					if( !empty($image) ): ?>
    						<article class="article-portfolio">
    							<a href="<?php the_permalink(); ?>">
    								<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
    							</a>
    						</article>
    				<?php endif;
    				endif;
    			 endwhile;
    			endif; ?>
    
    	</main>
    </div>
Viewing 1 replies (of 1 total)
  • Thread Starter ivan76

    (@ivan76)

    What can I use for display only topics from a category. in_category doesn’t work too.

Viewing 1 replies (of 1 total)

The topic ‘is_category archives’ is closed to new replies.