• Hello,

    I am having trouble excluding certain categories from my one site… if you go to https://www.whocsoc.com/whocsoc you’ll see beneath the slideshow and slider two headings called ‘Latest’ and ‘Featured’… I would like to exclude certain categories from showing up as ‘Latest’ but I’m having trouble doing so… anyone know how to help? I’ve tried inserting ‘cat=-27, -28’ etc… but either it doesn’t want to work, or I’m inserting it in the wrong place…

    This is a snippet of the .php coding that I’m assuming is linked to the ‘Latest’ Box…

    <?php
    //list featured slide previews
    $i = 0;
    $post_num = 1;
    $latest = new WP_Query(‘showposts=1 &cat=-26, -27, -28, -29’); while($latest ->have_posts()) : $latest->the_post(); ?>
    <?php if($i+1 == $post_num){ $noborder = ‘class=”noborder”‘; } ?>
    <?php if($i == 0){ ?>
    <div class=”inside”>

    <div class=”top”>

    <?php if ( (function_exists(‘has_post_thumbnail’)) && (has_post_thumbnail()) ) { ?>
    <?php $image_id = get_post_thumbnail_id(); $image_url = wp_get_attachment_image_src($image_id,’large’); $image_url = $image_url[0]; ?>
    <?php $blogurl = get_bloginfo(‘url’); $image_url = str_replace($blogurl, ”, $image_url); ?>
    “>
    <img src=”<?php echo bloginfo(‘template_url’); ?>/thumb.php?src=<?php echo $image_url; ?>&w=275&h=130&zc=1&q=100″ alt=”<?php echo the_title(); ?>” />
    <div class=”heading”><?php } else { ?><div class=”heading” style=”width:100%;”><?php }?>

    Any help would be greatly appreciated.

    Sincerely,
    Dewald

Viewing 1 replies (of 1 total)
  • May not make any difference, but try removing the spaces in the query arguments. Change this:

    $latest = new WP_Query('showposts=1 &cat=-26, -27, -28, -29');

    to this:

    $latest = new WP_Query('showposts=1&cat=-26,-27,-28,-29');

Viewing 1 replies (of 1 total)
  • The topic ‘Exclude categories on home page’ is closed to new replies.