Exclude Categories from Homepage
-
I am the webmaster for Day4Ministries.com.
I am trying to edit the home page so that a certain category won’t show up in the “Latest Content” section, but will still show up in the slider at the top.
Here is the code for the Latest Content section:
<div class="bloghead"><h2 class="homeblog">Latest Content</h2></div> <?php $count = 0; ?> <?php $hcount = get_option('role_hcount'); $new_query = new WP_Query( 'posts_per_page='.$hcount.'' ); while ( $new_query->have_posts() ) : $new_query->the_post(); ?> <div class="box <?php if (++$count % 4 == 0) { echo "lastbox"; } ?>" id="post-<?php the_ID(); ?>"> <div class="boxim"> <a href="<?php the_permalink() ?>"><img id="boximg" src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php get_image_url(); ?>&h=95&w=210&zc=1" alt=""/></a> </div> <div class="btitle"> <h2 class="hometitle"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2> </div> <div class="excerpt"> <?php wpe_excerpt('wpe_excerptlength_index', ''); ?> <div class="clear"></div> </div> <a class="bmore" href="<?php the_permalink() ?>">Read More</a> </div> <?php if(++$counter % 4 == 0) : ?>
Here is the code for the slider, cycle.php:
<div style="position: relative;" id="cycle"> <?php $slide = get_option('role_slide_cat'); $count = get_option('role_slide_count'); $slide_query = new WP_Query( 'category_name='.$slide.'&posts_per_page='.$count.'' ); while ( $slide_query->have_posts() ) : $slide_query->the_post(); ?> <div class="slide"> <div class="slide-content"> <h2><a class="sl-title" href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2> <?php wpe_excerpt('wpe_excerptlength_index', ''); ?> <div class="clear"></div> <a class="sl-more" href="<?php the_permalink() ?>">Read More</a> </div> <div class="slide-banner"> <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><img class="slidepic" src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php get_image_url(); ?>&h=250&w=550&zc=1" alt="<?php the_title(); ?>"/></a> </div> <div class="clear"></div> </div> <?php endwhile; ?> </div>
Here is all of index.php:
<?php get_header(); ?><div class="home-widget clearfix"> <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar('Services widgets') ) : else : ?> <?php endif; ?> </div> <div id="home-content"> <div class="container"> <div class="bloghead"><h2 class="homeblog">Latest Content</h2></div> <?php $count = 0; ?> <?php $hcount = get_option('role_hcount'); $new_query = new WP_Query( 'posts_per_page='.$hcount.'' ); while ( $new_query->have_posts() ) : $new_query->the_post(); ?> <div class="box <?php if (++$count % 4 == 0) { echo "lastbox"; } ?>" id="post-<?php the_ID(); ?>"> <div class="boxim"> <a href="<?php the_permalink() ?>"><img id="boximg" src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php get_image_url(); ?>&h=95&w=210&zc=1" alt=""/></a> </div> <div class="btitle"> <h2 class="hometitle"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2> </div> <div class="excerpt"> <?php wpe_excerpt('wpe_excerptlength_index', ''); ?> <div class="clear"></div> </div> <a class="bmore" href="<?php the_permalink() ?>">Read More</a> </div> <?php if(++$counter % 4 == 0) : ?> <div class="clear"></div> <?php endif; ?> <?php endwhile; ?> </div> </div> <?php get_footer(); ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Exclude Categories from Homepage’ is closed to new replies.