How can I get a list of custom post IDs into a variable I can use for another function?

You can push all your individual id’s from your foreach loop to a variable outside your foreach loop, like this (please note, this is not the preferred method as there is a simpler method, just scroll down) $post_ids = []; foreach((array) $all_posts->posts as $id) { $post_ids[] = $id; } ?><pre><?php var_dump($post_ids); ?></pre><?php $post_ids will hold … Read more

Create dropdown menu of all tags used in category

Try building a master $posttags array like so: <?php $post_tags = array(); $the_query = new WP_Query( ‘posts_per_page=50&cat=89’ ); if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); $posttags = get_the_tags(); foreach( $posttags as $posttag ) { $post_tags[$posttag->slug] = $posttag->name; } endwhile; endif; ?> <ul class=”dropdown filter option-set clearfix” data-filter-group=”tags”> <li><a href=”#filter-tags-all” data-filter-value=”.item” class=”selected”>All … Read more

Merge arrays and order set and subset as one

You can check get_post_meta before args, Example: // Get post meta $game = get_post_meta($post->ID, ‘sd_game’, true); $game_series = get_post_meta($post->ID, ‘sd_game_series’, true); // Check which meta if( !empty( $game ) ) { $key = ‘sd_game’; } else { $key = ‘sd_game_series’; } $posts = get_posts(array( ‘numberposts’ => -1, ‘post_type’ => ‘lyric’, ‘meta_query’ => array( array( ‘key’ … Read more

How do I pull post from standard post format?

The terms parameter will only accept custom post types and, like you mentioned, post-format-standard is not one. Try instead to use the ‘NOT IN’ operator to test against the custom posts you don’t want to display (all in this case): $query = array( ‘showposts’ => 5, ‘post_type’ => ‘post’, ‘tax_query’ => array( ‘relation’ => ‘OR’, … Read more