Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End How to pull post if only in both categories

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #196465
    amidigital
    Participant

    I only want to pull post if they are in 1770730 AND 690754.

    Thanks!

    “`<?php query_posts(‘category__and=1770730&category__and=690754’); ?>
    <?php if ( have_posts() ) : ?>
    <?php while ( have_posts() ): the_post(); ?>
    <?php get_template_part('content'); ?><br />
    <?php endwhile; ?>

    “`

    #196488
    Senff
    Participant
    $args = array(
       'category__and' => array(1770730, 690754) 
    );
    
    $the_query = new WP_Query( $args );
    
    if( $the_query->have_posts() ): 
        while ( $the_query->have_posts()) : $the_query->the_post(); 
            get_template_part('content'); 
        endwhile; 
    endif; 
    
    wp_reset_query(); 
    
    #196623
    amidigital
    Participant

    Thank you!

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Back End’ is closed to new topics and replies.