WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Only listing a few post titles in a catagory..?

[Resolved] Only listing a few post titles in a catagory..?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Samuel B
    Participant

    @samboll

    “><?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.

    <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>

    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.

    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 ‘[Resolved] Only listing a few post titles in a catagory..?’ is closed to new replies.