Viewing 8 replies - 1 through 8 (of 8 total)
  • I’ve posted on kitty’s website, but maybe someone here can help – I’m trying to use the show-categories plugin in order to exclude posts in a particular category from showing.
    I dropped the plugin file and activiated it. And replaced the particular code as follows:
    “In index.php replace:
    <?php if ($posts) : foreach ($posts as $post) : start_wp(); ?>
    with:
    <?php hide_category_posts( 'category=1' ); ?>
    <?php if ($hcp_posts) : foreach ($hcp_posts as $post) : start_wp(); ?>
    When I do this, nothing happens.
    I read on her website that someone suggested replacing the colons with curly brackets. When I do that, I receive this error message:
    Parse error: parse error, unexpected T_ENDFOREACH in /home/stefan/public_html/wp/index.php on line 194
    Any ideas/comments/suggestions?
    Thanks in advance 🙂

    An if statement such as this:

    <?php if ($posts and postID != postyoudonotwanttoappear) : foreach ($posts as $post) : start_wp(); ?>

    That exact code will not work- but that is the basic idea of what you want to do

    Thanks Clay,
    good info to know… not sure that is what I’m trying to do though. I’m wanting to hide a whole category of posts. So, anything I post in say “photos” category doesn’t appear to the public. But, then I plan on making a static “photos.php” page to call the posts into.
    Trying to use the “show-category” plugin from mookitty.co.uk but I must be doing something wrong based on my results above 🙁

    actually scratch that previous answer this SHOULD work-
    <?php if ($posts) : foreach ($posts as $post) : start_wp(); ?>
    <?php the_date('','<h2>','</h2>'); ?>

    <?php $postid = the_ID();
    if ($postid != theidyoudontwanttodisplay) ?>
    <div class="post">
    <h3 class="storytitle" id="post-<?php the_ID(); ?>">" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></h3>
    <div class="storycontent">
    <?php the_content(); ?>
    </div>
    <!--
    <?php trackback_rdf(); ?>
    -->

    <div class="feedback">
    <div class="CommentNumber">"><?php comments_number(); ?></div>">Leave a Comment</div>
    </div>
    <?php endif ?>

    oh- you can use the same basic idea.. an if statement which excludes the category you want not displayed..
    I can help more when i get home from work

    Clay –
    thanks for the response and info. I got a response from Kitten who created the plugin and am trying another avenue.
    thanks again!

    If you compare http://www.adailyadventure.com/journal/ with http://www.adailyadventure.com/journal/posts-cats.php You will see the solution in action: This is my edited ‘content’ file
    <?php include ('wp-includes/header.php') ?>
    <?php if ($posts) : foreach ($posts as $post) : start_wp(); ?>
    <?php if (! in_category(9)):?>

    CHANGE THE NUMBER IN PARENTHESIS TO THE CATEGORY YOU DO NOT WANT DISPLAYED
    <?php the_date('','<h2>','</h2>'); ?>
    <div class="post">
    <h3 class="storytitle" id="post-<?php the_ID(); ?>">" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></h3>
    <div class="storycontent">
    <?php the_content(); ?>
    </div>
    <!--
    <?php trackback_rdf(); ?>
    -->

    <div class="feedback">
    <div class="CommentNumber">"><?php comments_number(); ?></div>">Leave a Comment</div>
    </div>
    Add the below ENDIF statement

    <?php endif;?>
    <?php endforeach; else: ?>
    <?php _e('Sorry, no posts matched your criteria.'); ?>
    <?php endif; ?>
    <div id="pagination"><?php posts_nav_link() ?></div>
    <?php include ('wp-includes/footer.php') ?>

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Excluding posts from the main page’ is closed to new replies.