WordPress.org

Support

Support » How-To and Troubleshooting » Excluding asides from Recent Posts

Excluding asides from Recent Posts

  • I’ve read all the relevant threads I can find on this but have found nothing either up to date or definitively saying “impossible, you crazy”.

    I’m running twenty ten and I want to use the Asides to be little tweetlike lines between my main posts. This I can do fine but I then want to be able to exclude them from Recent Posts and Archives and that sort of thing.

    I assumed I could do this by making some exception to them in the relevant loops but I can’t find where to do that.

    I thought perhaps I could alter something in default-widgets.php but I couldn’t for the life of me see what.

    Anyone got something on this? I’d be most grateful.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Worked it out.

    Inspired by http://codex.wordpress.org/Adding_Asides#Displaying_Asides_on_the_Sidebar
    where it tells you how to exclude categorys from the loop I managed to add

    <?php if ( has_post_format( 'aside' )) continue; ?>

    to the default-widgets.php file, just after

    <?php while ($r->have_posts()) : $r->the_post(); ?>

    and it worked. Super pleased. I love wordpress.

    ah no, that hasn’t worked quite because I need to reload the ‘have posts’ thingy again.

    I need to insert <?php rewind_posts(); ?> but I can’t work out where in default-widgets.php would be the right place.

    eek.

    Or even if it ought to be in the sidebar or index phps instead.

    Oh this is miserable. I thought I had it 🙁

    It now excludes my asides from the recent posts list but also loses the oldest proper posts.

    Anything after the last excluded aside is left off. I’m assuming it needs that rewind code but could it be that I could modify the continue code so that it carried on after excluding the asides?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Excluding asides from Recent Posts’ is closed to new replies.
Skip to toolbar