• Resolved yasinansari

    (@yasinansari)


    I have a theme setup that runs the code below to remove 2 categories from displaying posts on a section of my website. Is there anyone who can look at this code and tell me how to add an category called Interviews to the exclusion list. The divider line is a new page that calls the first code.

    ————————
    `if ($version > “2.3”) {

    $featuredcat = get_option(‘woo_featured_category’); // ID of the Featured Category
    $ex_feat = $wpdb->get_var(“SELECT term_id FROM $wpdb->terms WHERE name=’$featuredcat'”);

    $vidcat = get_option(‘woo_video_category’); // ID of the Video Category
    $ex_vid = $wpdb->get_var(“SELECT term_id FROM $wpdb->terms WHERE name=’$vidcat'”);

    $showposts = get_option(‘woo_other_entries’); // Number of other entries to be shown

    } else {

    $featuredcat = get_option(‘woo_featured_category’); // ID of the Featured Category
    $ex_feat = $wpdb->get_var(“SELECT cat_ID FROM $wpdb->categories WHERE cat_name=’$featuredcat'”);

    $vidcat = get_option(‘woo_video_category’); // ID of the Video Category
    $ex_vid = $wpdb->get_var(“SELECT cat_ID FROM $wpdb->categories WHERE cat_name=’$vidcat'”);

    $showposts = get_option(‘woo_other_entries’); // Number of other entries to be shown

    }

    ————————

    include(TEMPLATEPATH . ‘/includes/version.php’);

    $the_query = new WP_Query(‘cat=-‘. $ex_feat . ‘,-‘ . $ex_vid . ‘&showposts=’ . $showposts . ‘&orderby=post_date&order=desc’);
    ————————

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘excluding categories from being displayed’ is closed to new replies.