Satch3000 Satch3000 - 1 month ago 9
PHP Question

Wordpress list all posts (excerpt) php loop

I am creating a wordpress template and I now need some code that creates a loop to show all posts but not full posts, just excerpts.

Can anyone help please?

Answer

Use this code to generate the excerpt into the loop:

<?php
    if(have_posts())
    {
        while(have_posts())
        {
            the_post();

            the_excerpt();
        }
    }
?>

The above will generate only the excerpt of the posts. If you need extra options like post title, date, author and more you have to read the WordPress codex. http://codex.wordpress.org/Main_Page

You can read more by following the link given by markratledge below.

Comments