one get_posts to return a number of custom posts for each meta value

Short answer: no. But if you want to use one loop for all your needed posts, you can do something like this: $args = array( ‘post_type’ => ‘product’, ‘meta_query’ => array( array( ‘key’ => ‘cf_type’, ‘value’ => ‘fog’, // need to have 10 with value ‘fog’ and 10 with value ‘gof’ ) ), ‘numberposts’ => … Read more

attachment.php & flexslider—linking thumbnail to specific image

The answer was to assign a count to each attachment: $args = array( ‘post_type’ => ‘attachment’, ‘numberposts’ => -1, ‘post_status’ => null, ‘post_parent’ => $post->ID, ‘order_by’ => ‘menu_order’, ‘order’ => ‘DESC’ ); $attachments = get_posts( $args ); if ( $attachments ) { $count = 0; foreach ($attachments as $attachment) { $link = get_permalink($attachment->ID); $link = … Read more

Worpress url parse

You must use add_rewrite_rule() method, or add_rewrite_endpoint() in order to flush rewrite rules, and links you must generate with add_query_arg() method for ugly urls, for tiny u must simple concatenate with permalink

WordPress – List Sub Categories and Sub-Sub Categories, With Posts

Try This : <!– Category Archive Start –> <ul class=”catArchive”> <?php $catQuery = $wpdb->get_results(“SELECT * FROM $wpdb->terms AS wterms INNER JOIN $wpdb->term_taxonomy AS wtaxonomy ON ( wterms.term_id = wtaxonomy.term_id ) WHERE wtaxonomy.taxonomy = ‘category’ AND wtaxonomy.parent = 0 AND wtaxonomy.count > 0″); $catCounter = 0; foreach ($catQuery as $category) { $catCounter++; $catStyle=””; if (is_int($catCounter / … Read more