List all titles of WordPress posts in one page

Wednesday, December 31st, 2008
Advertisement

Subscribe.
Enter your email:

Using this code, you can list all titles of WordPress posts in one page. An example of usage is in an Archives page.

<ul>
<?php
    global $post;
    $myposts = get_posts('numberposts=-1&offset=1');
    foreach($myposts as $post) :
?>
<li>
    <a href="<?php the_permalink(); ?>">
    <?php the_title(); ?>
    </a>
</li>
<?php endforeach; ?>
</ul>

You can change it to n number of posts, by changing -1 in “numberposts=-1″ to n.
For tutorial on how to create an Archives page, please read this article.

If you are new here, you might want to subscribe to the RSS feed or newsletter.

Enter your email address:

Creates the exact copy of your hard disk and allows you to instantly restore the entire machine.
New Acronis True Image Home 2010 is the most reliable and easy in use backup solution. Now with online backup option!
15% Discount Code: FMAATIH2010

What else?

Like this article? Share it

 Digg  del.icio.us  TwitThis  Facebook  Reddit  StumbleUpon

7 Responses to “List all titles of WordPress posts in one page”

  1. aman says:

    nie tuk wat ape yerk? arkib ker?

    amans last blog post..Sumber Terbuka dan Linux Sepanjang 2008

  2. Hanep says:

    untuk arkib la kot…

  3. KNizam says:

    those codes shud be paste into a page rite ?

    KNizams last blog post..Dah Bayar Zakat For 2008 Ke ?

  4. Selinap says:

    @aman, @Hanep: Untuk apa sahaja. Boleh juga digunakan untuk front page.

    @KNizam: Untuk arkib, bina template arkib dan paste kod tersebut. Kemudian bina page dengan template arkib sebagai default template.

  5. KNizam says:

    camner nak buat archive tu eh ?

    KNizams last blog post..Salam Tahun Baru 2009 !

  6. [...] Now, you already have an archives page by month and by subject/category. By the way, you could also have the archives page to display some or all posts title, as discussed in this article. [...]

  7. [...] on a recent post in the sidebar or next page at the bottom of the website. I’d like to see a list all titles of articles in one page. Actually, I want to see that implemented on all self hosted wordpress based [...]

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>