• hi, i’m trying to list the titles of the posts of two particular categories, in different parts of a page.
    i’ve used the script below, for a single category, and it works like charm. but if i try to re-use it, for the second category, it only shows over and over again ONE special title of one of the posts.

    can you guys give me some insight? i’m an absolute noob in php programming. Thanks!

    <?php
               global $post;
               $myposts = get_posts('category="whatever1"');
               foreach($myposts as $post) :
               ?>
               <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
               <?php endforeach; ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Listing Post Titles – problem in the script’ is closed to new replies.