• Hallo,

    In out theme we have a featured category. We like to display this catagory on the right sidebar of the Website, this works without any problems. However, we want to only see the featured catagory on the sidebar, not on the homepage, currently we see the post on the homepage and on the sidebar.

    Is it possible, and how, to have content display (a blog or post) only on the sidebar and not on the homepage?

    Thanks!

Viewing 12 replies - 1 through 12 (of 12 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    You will have to alter your theme’s template files (index.php) and use a query to exclude posts with the featured category using query posts:
    http://codex.wordpress.org/Function_Reference/query_posts
    http://codex.wordpress.org/Function_Reference/WP_Query

    Thread Starter rvdveer

    (@rvdveer)

    Hi,

    Altough this answers the question, it assumes that there is knowledge of programming. Would you be able to tell me what to put in the index.php and or another php config file?

    Or is there a plugin that would work?

    Moderator keesiemeijer

    (@keesiemeijer)

    What theme are you using (link please)? Are you using widgets to show the categories in the sidebar? Link to site?

    Thread Starter rvdveer

    (@rvdveer)

    Hi,

    The ÜRL to my site is www2.graceministries.nl

    The theme I am using is Arqua by MagPress.com

    Link: http://www.magpress.com/index.php?s=arqua

    I switch the Featured category on in my theme options and it is displayed on the sidebar.

    Does this help?

    Moderator keesiemeijer

    (@keesiemeijer)

    So you want to remove the “Featured News” slider from the homepage?
    I don’t see the featured cat in the sidebar.

    Thread Starter rvdveer

    (@rvdveer)

    Hallo,

    The featured category is now displayed it is called uitgelicht.
    As you can see the category is also displayed on the homepage, I like to only display on sidebar – not also on homepage.

    Thanks for all your help!

    Moderator keesiemeijer

    (@keesiemeijer)

    to remove the slider remove this from index.php:

    <?php $featured_slider_activate = get_theme_option('featured_activate'); if(($featured_slider_activate == '') || ($featured_slider_activate == 'No')) { ?>
    <?php { /* nothing */ } ?>
    <?php } else { ?>
    <?php if((is_home()) && (is_front_page()) && ($paged < 1)) { ?>
    <?php include (TEMPLATEPATH . '/includes/featured.php'); ?>
    <?php } ?>
    <?php } ?>

    to remove the posts with the featured cat from the front page replace this from index.php:

    <?php $postcounter = 0; if (have_posts()) : ?>

    to:

    <?php
    $featured_category = get_theme_option('featured_category');
    query_posts('cat=-'.$featured_category );
    ?>
    <?php $postcounter = 0; if (have_posts()) : ?>

    Thread Starter rvdveer

    (@rvdveer)

    Hi,

    I tried it, it does not seem to work.

    This is my index.php:

    <?php if ((!function_exists(“check_theme_footer”) || !function_exists(“check_theme_header”))) { ?><?php { /* nothing */ } ?><?php } else { ?><?php get_header(); ?>

    <div id=”content”>
    <div id=”contentinner”>

    <?php $featured_slider_activate = get_theme_option(‘featured_activate’); if(($featured_slider_activate == ”) || ($featured_slider_activate == ‘No’)) { ?>
    <?php { /* nothing */ } ?>
    <?php } else { ?>
    <?php if((is_home()) && (is_front_page()) && ($paged < 1)) { ?>
    <?php include (TEMPLATEPATH . ‘/includes/featured.php’); ?>
    <?php } ?>
    <?php } ?>

    <div id=”post-entry”>

    <?php
    $featured_category = get_theme_option(‘featured_category’);
    query_posts(‘cat=-‘.$featured_category );
    ?>
    <?php $postcounter = 0; if (have_posts()) : ?>

    <?php while (have_posts()) : $postcounter = $postcounter + 1; the_post(); ?>

    <div class=”post-meta” id=”post-<?php the_ID(); ?>”>
    <div class=”post-info”>
    <h2>” rel=”bookmark” title=”<?php the_title(); ?>”><?php the_title(); ?></h2>
    <div class=”post-date”>
    Published <?php the_time(‘l, F j, Y’) ?> By <?php the_author_posts_link(); ?>. Under <?php the_category(‘, ‘) ?>  <?php if(function_exists(“the_tags”)) : ?><?php the_tags(‘Tags: ‘) ?><?php endif; ?>  <?php edit_post_link(‘+Edit Post’); ?>
    </div><!– POST DATE END –>
    </div><!– POST INFO END –>
    <div class=”post-content”>
    <?php if ( has_post_thumbnail() ) { ?>
    <?php the_post_thumbnail(array(200,150), array(‘class’ => ‘alignleft’)); ?>
    <?php } ?>
    <?php the_post_excerpt($excerpt_length=50); ?>
    <div class=”readmore”>” title=”<?php the_title(); ?>”>Read More</div>
    <div class=”clearfix”></div>
    </div><!– POST CONTENT END –>
    </div><!– POST META <?php the_ID(); ?> END –>

    <?php $get_google_code = get_theme_option(‘adsense_loop’); if($get_google_code == ”) { ?>
    <?php } else { ?>
    <?php if($postcounter <= 3){ ?>
    <div class=”adsense-loop”>
    <?php echo stripcslashes($get_google_code); ?>
    </div>
    <?php } ?>
    <?php } ?>

    <?php endwhile; ?>

    Again,

    Thanks!

    Moderator keesiemeijer

    (@keesiemeijer)

    How to post code in WordPress forum topics: http://codex.wordpress.org/Forum_Welcome#Posting_Code

    Moderator keesiemeijer

    (@keesiemeijer)

    try replacing:
    query_posts('cat=-'.$featured_category );
    with:
    query_posts( $query_string . 'cat=-'.$featured_category );
    or

    query_posts( $query_string . 'cat=-22'); // change ID (22) to featured category ID
    Thread Starter rvdveer

    (@rvdveer)

    Thanks a lot, the second option worked!!!

    Thanks again.

    Moderator keesiemeijer

    (@keesiemeijer)

    You’re welcome. Glad you got it resolved.

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

The topic ‘Featured Category’ is closed to new replies.