Custom loop attached to link

Something like this: Make an URL like /companies/?leaders Than in your archive template (top): if(isset($_GET[‘leaders’])) { global $query_string; $query_string = $query_string . ‘&meta_key=leaders&meta_value=yes’; query_posts($query_string); } Hope this helps.

Can I include get_posts in this array?

I’m assuming there is an option in the array that is meant to receive an array of options for the checkboxes…? In which case, you can use get_posts to obtain an array of post objects (of which ever type), and then loop through this, to create an array of post titles: For example.. $args=array(‘numberposts’=>-1,’post_type’ => … Read more

Can I paginate this get_attachment query?

Yup. You’ll need to get/set $paged with your query, like so: <?php $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $args = array( ‘numberposts’ => 15, ‘orderby’ => ‘menu_order’, ‘order’ => ‘ASC’, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘post_parent’ => $post->ID, ‘paged’ => $paged ); ?> <?php $photos = new WP_Query($args); ?> <?php if ( $photos->have_posts() … Read more

Retrieve all term IDs of post

Try out this code and see if it works for you, I just cooked it up real quick and haven’t tested it, so it may be way off base, but the concept is there. $tax_args = array( ‘public’ => true ); $taxonomies = get_taxonomies( $tax_args, ‘names’, ‘or’ ); $term_args = array( ‘fields’ => ‘ids’ ); … Read more

Trim posts from WP-Query?

I think it would be better to just do a second query if you don’t have 8 posts for that month, for example: //get current date $date = getdate(); //setup args $args = array( //basic stuff ‘posts_per_page’ => -1, ‘post_stutus’ => ‘publish’, //time parameters ‘year’ => $date[‘year’], ‘month_num’ => $date[‘mon’] ); //create WP_Query $my_query = … Read more

Get array of posts based on custom field values

Look at the meta_query argument, and the “IN” option for the “Compare” operator. Your query would look something like: $args = array( ‘product’ => $product, ‘meta_query’ => array( array( ‘key’ => ‘primary_link’, ‘value’ => array( ‘home’, ‘obj_handling’, ‘standalone_doc’, ‘advantages’, ‘weaknesses’, ‘top_comments’ ), ‘compare’ => ‘IN’ ) ) );