• I’ve looked through the forums but to the best of my knowledge there isn’t a thread that answers my particular question. So here goes…

    I’m working on a blog with both commercial and non-commercial stuff. I’d like the non-commercial posts to be displayed in an RSS feed for another website.

    My idea was simply to create a category called “non-commercial” and tick off the individual posts that applied to this category and thus were included in the customised, “non-commercial” RSS feed.

    But how do I make it so that the “non-commercial” category isn’t visible in the applicable posts to readers of my blog?

    Or is there another, simpler way to do this?

    Thank you all in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Essentially need to use a conditional tag to do that. The Loop article has some examples that apply, but in your loop it would be something like

    <?php
    //assumes category id 3 is your non-commerical category
    if ( ! in_category('3') ) {
      the_category();
    }
    ?>
    Thread Starter aamand

    (@aamand)

    Thanks, MichaelH.

    My K2 Loop looks like this:

    <?php
    /**
     * Default Loop Template
     *
     * This file is loaded by multiple files and used for generating the loop
     *
     * @package K2
     * @subpackage Templates
     */
    
    // Post index for semantic classes
    $post_index = 1;
    
    while ( have_posts() ): the_post(); ?>
    
    	<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    		<div class="entry-head">
    			<h3 class="entry-title">
    				<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php k2_permalink_title(); ?>"><?php the_title(); ?></a>
    			</h3>
    
    			<?php /* Edit Link */ edit_post_link( __('Edit','k2_domain'), '<span class="entry-edit">', '</span>' ); ?>
    
    			<?php if ( 'post' == $post->post_type ): ?>
    			<div class="entry-meta">
    				<?php k2_entry_meta(1); ?>
    			</div> <!-- .entry-meta -->
    			<?php endif; ?>
    
    			<?php /* K2 Hook */ do_action('template_entry_head'); ?>
    		</div><!-- .entry-head -->
    
    		<div class="entry-content">
    
    			<?php if ( function_exists('has_post_thumbnail') and has_post_thumbnail() ): ?>
    				<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail( array( 75, 75 ), array( 'class' => 'alignleft' ) ); ?></a>
    			<?php endif; ?>
    			<?php the_content( sprintf( __('Continue reading \'%s\'', 'k2_domain'), the_title('', '', false) ) ); ?>
    		</div><!-- .entry-content -->
    
    		<div class="entry-foot">
    			<?php wp_link_pages( array('before' => '<div class="entry-pages"><span>' . __('Pages:','k2_domain') . '</span>', 'after' => '</div>' ) ); ?>
    
    			<?php if ( 'post' == $post->post_type ): ?>
    			<div class="entry-meta">
    				<?php k2_entry_meta(2); ?>
    			</div><!-- .entry-meta -->
    			<?php endif; ?>
    
    			<?php /* K2 Hook */ do_action('template_entry_foot'); ?>
    		</div><!-- .entry-foot -->
    	</div><!-- #post-ID -->
    
    <?php endwhile; /* End The Loop */ ?>

    Now where do I insert the code you posted?

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Invisible/hidden category for specific posts’ is closed to new replies.