Viewing 7 replies - 1 through 7 (of 7 total)
  • “><?php the_title(); ?>
    This line is correct?

    It’s just because people never learn how to post code ??

    it is supposed to be
    <li><a>"><?php the_title(); ?></a></li>

    Edit. Though it doesn’t make sense even in this way.

    Thread Starter sithicus

    (@sithicus)

    <div class="cat-title">food & nutrition:</div>
    <ul>
    <?php $posts = get_posts('category=2');
    foreach($posts as $post) : ?>
    <li><a href="<?php the_permalink(); ?>">
    <?php the_title(); ?></a></li>
    <?php endforeach; ?>
    </ul>

    Thread Starter sithicus

    (@sithicus)

    I hope that helps.. when posting code.. do I have to put each line between the ` ?

    No, just don’t have a blank line in the code – blank lines break the effect of the backticks.

    Thread Starter sithicus

    (@sithicus)

    Yet no thoughts on how to get this code to list more then 5 results… ?

    MEanwhile you were waiting here for an answer you could read as well the codex: Template_Tags/get_posts.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Only listing a few post titles in a catagory..?’ is closed to new replies.