WordPress.org

Forums

Question about the wordpress "loop" (5 posts)

  1. Wiki Chaves
    Member
    Posted 7 years ago #

    Hi,

    I´m building my blog and I have on mind a particular structure that i have never seen before. I want to have in my homepage a fixed part, like an "about" and then, bellow, the posts (or news, like called)

    What i could do, is to display this about page at the top of my blog. For doing this I´ve wrote a page (id #4) and i add this linke to the index.php

    <?php if (is_home()) { query_posts("page_id=4"); } ?>

    before the <?php if (have_posts() ...

    the problem is that i want the posts below this fixed part, but i can´t make it.

    does anybody know how to do this ?

    if you want to see what i`ve done till now> http://www.wikichaves.com/blog (in spanish)or here a google traslated

    you can see the posts titles only in the right bar (i want them below also)

    thanks
    Francisco

  2. Justin Tadlock
    WordPress God
    Posted 7 years ago #

    You need to make a new loop after your first loop. I suppose you should add the line:

    wp_reset_query();

    After the first loop.

    If you just want post titles, then use wp_get_archives() instead of the second loop.
    http://codex.wordpress.org/Template_Tags/wp_get_archives

  3. Wiki Chaves
    Member
    Posted 7 years ago #

    hmm, i´m afraid i´ve tried this but didn´t worked :(

  4. maestro42
    Member
    Posted 7 years ago #

    what about using the Sticky Plugin to have one post always stay at the top ?

    http://wordpress.org/extend/plugins/simple-sticky-posts/

  5. Justin Tadlock
    WordPress God
    Posted 7 years ago #

    If wp_reset_query() doesn't work, then just make a new query.

    I run multiple loops in many of my themes. Creating a new loop definitely works.

    So, you would have:

    query_posts()
    Loop 1
    query_posts()
    Loop 2

    Using a plugin for this is pretty much pointless unless you really don't want to touch code.

Topic Closed

This topic has been closed to new replies.

About this Topic