WP_Query for attachments without duplicating post_parent and displaying tagged image

After giving it another look with some fresh eyes, I decided to add a third loop within Loop 2 and not have it working as desired: $media_args = array( ‘post_type’ => ‘attachment’, ‘posts_per_page’ => -1, ‘tax_query’ => array( array( ‘taxonomy’ => ‘products’, ‘field’ => ‘term_id’, ‘terms’ => $product_tag ) ) ); // Loop 1 – … Read more

How to query all custom posts of a certain type and checking what category they have

Alright I figured it out! $args = array( ‘post_type’ => ‘vendors’, ‘order’ => ‘asc’, ‘orderby’ => ‘title’, ); $query = new WP_Query( $args ); if ( $query->have_posts() ) { echo ‘<ul>’; while ( $query->have_posts() ) { $query->the_post(); $category = get_the_category(); echo ‘<li class=”‘; echo $category[0]->category_nicename; echo ‘”>’ . get_the_title() . ‘</li>’; } echo ‘</ul>’; } … Read more

Query pages by child term

What do you mean by “dynamic” ? Do you want it to work with different posts? If so, that’s simple. Before your get_posts query function, get page terms, and pass them to your array. You can get taxonomies with <?php get_the_terms( $yourpostid, ‘your_custom_taxonomy’); ?>

Load 3 posts in flexslider slide [closed]

I ended up doing this – works perfectly. <?php $argsb = array(‘posts_per_page’ => -1, ‘post_status’ => ‘publish’);?> <?php $blog = new WP_Query($argsb); if ( $blog->have_posts() ): ?> <section class=”blog-slider slider”> <div class=”flexslider”> <ul class=”slides”> <?php while ( $blog->have_posts() ) : $blog->the_post(); $i++;?> <?php if( $blog->current_post % 3 == 0 ) echo “\n”.'<li class=”slide”>’.”\n”; ?> <article … Read more

pre_get_posts main_query not displaying after applying tax_query filters

The issue I had with my search was that the select field’s name was the same name as the taxonomy being queried. When I used a different name for the select field my query worked as it should. <?php wp_dropdown_categories(array( ‘name’ => ‘special_day_select’, //anything else besides an existing taxonomy name. ‘taxonomy’ => ‘special_day’ )); ?> … Read more