WordPress.org

Forums

List all posts on front page (2 posts)

  1. flexnds
    Member
    Posted 5 years ago #

    Hello,

    I need to list all posts on my front page. I want all the posts on the fron page to include all of the content and the title. I would also like them to be listed in alphabetical order.

    <?php
    // we add this, to show *all* posts sorted
    // alphabetically by title
         $posts = query_posts($query_string . '&orderby=title&order=asc&posts_per_page=-1');
    // here comes The Loop!
    if (have_posts()) : while (have_posts()) : the_post(); ?>

    The above code was found at http://codex.wordpress.org/Alphabetizing_Posts
    This code is very close to doing the trick but it does not include the title of the post or any way to separate the posts with say an <hr /> html tag.

    Thanks,
    Nathaniel

  2. flexnds
    Member
    Posted 5 years ago #

    Nevermind... Resolved.. Here is the code..

    <?php
    // we add this, to show *all* posts sorted
    // alphabetically by title
         $posts = query_posts($query_string . '&orderby=title&order=asc&posts_per_page=-1');
    // here comes The Loop!
    if (have_posts()) : while (have_posts()) : the_post(); ?>
    <hr />
    <h1><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1>

Topic Closed

This topic has been closed to new replies.

About this Topic