Forums

[resolved] Hide some content on sidebar if is home (4 posts)

  1. calevais
    Member
    Posted 6 months ago #

    I like to hide some content from my sidebar when at home. I learnt about is_home() but I really don't know how to use it.
    Content I want to show everywhere except homepage is:

    <h3 class="mast">Lo &uacute;ltimo</h3>
      <div id="side_categories2">
    	<ul class="cat">
    						<?php $the_query = new WP_Query('showposts=6&offset=3&orderby=post_date&order=desc'); while ($the_query->have_posts()) : $the_query->the_post(); $do_not_duplicate = $post->ID; ?>
    
    						<li><a href="<?php the_permalink(); ?>" rel="bookmark" title="enlace permanente a <?php the_title(); ?>"><?php the_title(); ?>,<br /><font color="#666"><?php the_time('j F'); ?></font></a></li>
    
    						<?php endwhile; ?>
      </ul></div>

    How can I do that?
    My blog is http://janes.es

    THANKS A LOT!

  2. Ivovic
    Member
    Posted 6 months ago #

    Try:

    <?php if (!is_home()) : ?>
    Code to show here.
    <?php endif; ?>

    note: the ! means "not"

  3. calevais
    Member
    Posted 6 months ago #

    Thanks a lot! I can't believe it was so easy! :-)

  4. Ivovic
    Member
    Posted 6 months ago #

    As I always say, it's not the 5 minutes you pay for, it's the experience it takes to do it in 5 minutes ;)

Reply

You must log in to post.

About this Topic