WordPress.org

Ready to get started?Download WordPress

Forums

asides and query_posts (5 posts)

  1. iand
    Member
    Posted 8 years ago #

    Yesterday I was trying to get query_posts to exclude a category, but couldn't get it to work. I assumed this was as I was using the asides as outlined here which don't seem to use the WP1.5 loop. With a bit of trial and error, I think I have got something that will work with the classic template and allow query-posts to be used.

    Questions are:
    1. Should query_posts work with the asides instructions linked to above?
    2. If not, is it worth me testing further and documenting so that asides and query_posts can live happily together?

  2. iand
    Member
    Posted 8 years ago #

    Adding to the questions, does anyone know what the follow code (from adding asides page) actually does.
    <?php
    if ($posts)
    {
    function stupid_hack($str)
    {
    return preg_replace('|</ul>s*<ul class="linklog">|', '', $str);
    }
    ob_start('stupid_hack');
    foreach($posts as $post)
    {
    start_wp();
    ?>

    As far as I can tell the asides work without it. It must do something though.

  3. masquerade
    Member
    Posted 8 years ago #

    replaces <ul class="linklog"> with nothing.

  4. iand
    Member
    Posted 8 years ago #

    Thanks, now I just have to figure out why that is useful :)

  5. iand
    Member
    Posted 8 years ago #

    Result! http://photomatt.net/2004/05/19/asides/
    As far as I can understand it it will combine multiple asides so
    <ul class="linklog">
    <li>aside 1</li>
    </ul>
    <ul class="linklog">
    <li>aside 2</li>
    </ul>

    becomes
    <ul class="linklog">
    <li>aside 1</li>
    <li>aside 2</li>
    </ul>

    Who knows, someone might find this useful to know. Now to answer 1 and 2 myself aswell :)

Topic Closed

This topic has been closed to new replies.

About this Topic