Excluding asides from Recent Posts (5 posts)

  1. bse00
    Posted 5 years ago #

    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.

  2. bse00
    Posted 5 years ago #

    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.

  3. bse00
    Posted 5 years ago #

    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.


  4. bse00
    Posted 5 years ago #

    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.

  5. bse00
    Posted 5 years ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic