[resolved] [Arras theme] Hide Recent Posts from homepage (5 posts)

  1. ryan76nz
    Posted 6 years ago #

    I'm trying to show the Recent Posts only on pages other than the homepage (ie. hide from the homepage). Using Arras theme.

    I've experimented with the sidebar-single.php file but nothing I do to this file seems to make any difference.

    Can anyone help please?

  2. MichaelH
    Posted 6 years ago #

    In sidebar.php delete this:

    <li class="widgetcontainer clearfix">
    				<h5 class="widgettitle"><?php _e('Recent Posts', 'arras') ?></h5>
    				<div class="widgetcontent">
    				$r = new WP_Query(array('showposts' => $number, 'what_to_show' => 'posts', 'nopaging' => 0, 'post_status' => 'publish', 'caller_get_posts' => 1));
    				if ($r->have_posts()) :
    				<?php while ($r->have_posts()) : $r->the_post(); ?>
    				<li><a href="<?php the_permalink() ?>"><?php if ( get_the_title() ) the_title(); else the_ID(); ?> </a></li>
    				<?php endwhile ?>

    Remember changes to themes like this could be blown away with future 'automatic' upgrades so backup your theme files when you make customizations. See WordPress Backups

  3. ryan76nz
    Posted 6 years ago #

    Hi, thanks for the reply. I've done that but it doesn't seem to help - if Recent Posts is added through the Widget interface it appears on all pages and if it isn't, it doesn't appear anywhere.

    Have I missed something?

  4. MichaelH
    Posted 6 years ago #

    Ah, if you are using widgets then look at

  5. ryan76nz
    Posted 6 years ago #

    Awesome, that's perfect. Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic