0

i want to display blog category month list in archive widgets. but i i can't figure out yet how. i have more category like review, gallery etc. normally show all month list in archive widgets but i want only BLOG show in archive widgets. i already figure our how to show only blog post in archive page but now problem is widgets. any idea guys how ?

1
add_filter( 'getarchives_join' , 'getarchives_join_filter');
function getarchives_join_filter( $join ) {
    global $wpdb;
    return $join . " INNER JOIN {$wpdb->term_relationships} tr ON ($wpdb->posts.ID = tr.object_id) INNER JOIN {$wpdb->term_taxonomy} tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id)";
}

add_filter( 'getarchives_where' , 'getarchives_where_filter');
function getarchives_where_filter( $where ) {
    global $wpdb;


    return $where . " AND tt.taxonomy = 'category' AND tt.term_id='blog category id' ";

    }

Change 'blog category id' with your blog category id.

  • wow..... its working nice... thanks @rajeev vyas.. thanks you so much.. – pagol Jun 21 '13 at 8:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.