WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. ryan76nz
    Member
    Posted 4 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
    Member
    Posted 4 years ago #

    In sidebar.php delete this:

    <li class="widgetcontainer clearfix">
    				<h5 class="widgettitle"><?php _e('Recent Posts', 'arras') ?></h5>
    				<div class="widgetcontent">
    <?php
    				$r = new WP_Query(array('showposts' => $number, 'what_to_show' => 'posts', 'nopaging' => 0, 'post_status' => 'publish', 'caller_get_posts' => 1));
    				if ($r->have_posts()) :
    ?>
    				<ul>
    				<?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 ?>
    				</ul>
    <?php
    				wp_reset_query();
    				endif;
    ?>
    				</div>
    			</li>

    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
    Member
    Posted 4 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
    Member
    Posted 4 years ago #

    Ah, if you are using widgets then look at
    http://wordpress.org/extend/plugins/widget-logic/

  5. ryan76nz
    Member
    Posted 4 years ago #

    Awesome, that's perfect. Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic