• Resolved raj137

    (@raj137)


    Hi,
    I am trying to show the query result for a combination of taxonomies:
    Category= nature and video-type (my custom taxonomy) = lecture. The posts should be displayed only if both the conditions are satisfied.

    Here is the code I am using:

    <?php
    				$article_count=0;
    				$args = array(
    								'video-type' => 'lecture',
    								'category' => 'nature',
    							);
    				$query = new WP_Query( $args );
    				$article_count = $query->post_count;
    				if ($article_count) {
    						echo "
    
    <ol>";
    							$posts = $query->posts;
    							foreach ($posts as $post) {
    									echo "
    
    <li> <a>".$post->post_title."</a> </li>
    ";
    									}
    								echo "</ol>
    ";
    							}
    					?>


    [Please use the code button, NOT blockquote when posting code]

    The code is somehow displaying all the values that are valid for taxonomy condition video-type = lectures irrespective of category value.
    However, for custom taxonomies (checked another one), it seems the condition is working. Can you please let me know if there is some issue or I am doing something wrong?
    Also, the list numbering

      is not apprearing
      Thanks!

    Viewing 2 replies - 1 through 2 (of 2 total)
    • Moderator Ipstenu (Mika Epstein)

      (@ipstenu)

      🏳️‍🌈 Advisor and Activist

      Two things.

      1) Are you sure this is a multisite specific issue?

      2) Can you repost your code, in the CODE tags please? Or put it on pastebin or gist, so we can actually see it? When you post without code tags, things get eaten by the server.

      Thread Starter raj137

      (@raj137)

      Hi,
      Thanks for your response. I could figure it out today and was going to close the post. It was a mere cache issue that I had to clean up. Some problem in my computer for IE.
      Moreover, I had to correct the category as ‘category_names’ in the code to get the array working.

      Best Regards,
      Rajiv

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

    The topic ‘Bug- Query display with array’ is closed to new replies.