Forum Replies Created

Viewing 1 replies (of 1 total)
  • Forum: Hacks
    In reply to: Count posts by slug
    Thread Starter xdynx

    (@xdynx)

    DONE
    // $tags = “slu1,slug2”;
    function countposttags($tags) {
    global $wpdb;

    $tags = explode(“,”, $tags);

    $myquery[‘tax_query’] = array();

    foreach ($tags as $tag) {

    array_push($myquery[‘tax_query’], array(
    ‘taxonomy’ => ‘adstags’,
    ‘terms’ => array($tag),
    ‘field’ => ‘slug’,
    ));
    } // end forech

    $a = query_posts($myquery);
    return sizeof($a);

    }

Viewing 1 replies (of 1 total)