Forums

How do I put post headings on my homepage? (4 posts)

  1. trisony
    Member
    Posted 3 years ago #

    On my homepage I have a "recent posts" sidebar with a link to the blog. It's a .php include. I want to list the headings of recent posts on there. Can someone please tell me how I can do this? I want it to update this automatically.

    Thank you!

  2. nex2nun
    Member
    Posted 3 years ago #

    All you would need to change in the following code would be the "category_name=" to be the category you want to display.

    <?php query_posts('category_name=events'); ?>
    <?php while (have_posts()) : the_post(); ?> 
    
    <ul>
    <li><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></li>
    </ul>   
    
    <?php endwhile; ?>

    Hope this helps!
    Derek M.

  3. trisony
    Member
    Posted 3 years ago #

    Thanks for your help, but my homepage is outside of the blog folder (its actually the main websites .index homepage). Can you please tell me how I can use that code on a web page that is not part of the actual blog?

    Thanks!

  4. nex2nun
    Member
    Posted 3 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.