Support » Fixing WordPress » Code check: List current category post titles dynamically

  • When finished this should be able to run in the sidebar/ as widget.

    The following code should work. What am I overlooking?

    <h2><?php single_cat_title() ?></h2>
    
    <?php
    $categoryvariable=$cat; // assign the variable as current category
     $query= 'cat=' . $categoryvariable. '&orderby=date&order=ASC'; // concatenate the query
     query_posts($query); // run the query
    if ($myposts):
    foreach ($myposts as $post):
    setup_postdata($post);
    the_title();
    endforeach;
    else :
    // Nothing Found
    endif;
    ?>

    Thank you

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Code check: List current category post titles dynamically’ is closed to new replies.