WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Exclude Catagory From Homepage? Nothing Has Worked. (3 posts)

  1. komplex
    Member
    Posted 1 year ago #

    Trying to exclude certain categories from the homepage. Now BlogHue's awesome code worked fine, but then they added in another index for a new section on my site, and it doesn't work anymore.. And they can't fix it.. And somehow I have 2 indexes..

    So I'm looking at the Index loop now: (This is what I want to do) I'm assuming it will work? Since the functions.php version didn't.

    Indexes

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('posts_per_page=10&paged='.$paged);
    ?>
    <?php $i=1; if (have_posts()) : ?>
    
    <?php while (have_posts()) : the_post(); ?>
    
    <li>
    <?php if($i==1){ ?>
    
    <div class="PRIVATE">
    
    <?php $i++; } else { ?>
    
    <div class="PRIVATE">
    
    <?php $i=1; } ?>
    
    <span><?php the_category(', ') ?></span>[/quote]And the other index file:
    
    [quote]
    <?php $i=1; if (have_posts()) : ?>
    
    <?php $category_id = get_cat_ID( 'Weight Loss' ); //echo $category_id ; ?>
    <?php
    
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts("paged=$paged&cat=".$category_id);
    
    wp_pagenavi();
    
    ?>
    
    <div class="clear"></div>
    
    </div>
    
    <!-- PRIVATE -->
    
    <!-- PRIVATE -->
    
    <div class="PRIVATE">
    
    <ul>
    <?php $category_id = get_cat_ID( 'Weight Loss' ); //echo $category_id ; ?>
    <?php
    
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts("paged=$paged&cat=".$category_id); ?>
    
    <?php $i=1;
    
    while(have_posts()): the_post();
    
    ?>
    
    <?php if(($i==1)||($i==2)){ ?>
    
    <li class="<?php if($i%3==0){ echo "nopad2"; }else { echo ""; } ?>">
    <span>$<?php $mykey_values = get_post_custom_values('price'); ?><?php if($mykey_values[0]!=NULL){ ?><?php echo $mykey_values[0]; ?><?php } else { ?>1,849<?php } ?></span>
    
    <h4><?php echo substr(get_the_title(), 0,35); ?></h4>
    
    <div class="new <?php echo $i; ?>">
    
    <?php if ( has_post_thumbnail() ) { the_post_thumbnail(); } ?>
    
    </div>
    
    [/quote]</ul>
    </li>
  2. Aaron
    Member
    Posted 1 year ago #

  3. komplex
    Member
    Posted 1 year ago #

    Nevermind figured it out thanks! Please delete! :)

Topic Closed

This topic has been closed to new replies.

About this Topic