WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to combine single post and a page together? (8 posts)

  1. maorb
    Member
    Posted 4 years ago #

    Hi,

    I want to build the homepage of a site, that will have on the top a featured post area, and below that to place some text of a static page.
    How can I know how to create the home.php to call the featured post, but how can I combine to the template both?

    I think maybe instead, to define the homepage as a static page and make a page template that will show on its top the featured category, but how can posts be called from a static page template?

    Will be happy for your ideas.
    Thanks

  2. MichaelH
    Member
    Posted 4 years ago #

    but how can posts be called from a static page template?

    See the Page of Posts example in the Pages article.

  3. maorb
    Member
    Posted 4 years ago #

    Thanks Michael.

    It seems that the example there will create a page to show posts from category X on a page, but what about the content that the page itself holds?
    I didn't manage to see there a call to the page's content itself, or have I missed something?

  4. MichaelH
    Member
    Posted 4 years ago #

    You would need a loop for that. Look at the WordPress Default theme's page.php for what that could be...

  5. maorb
    Member
    Posted 4 years ago #

    So I have to put on the pageOfPosts 2 loops? one for the post loop for the featured category, and one for the regular static page loop?

    Won't they collide each other? Or it will be ok to use the regular loop for the static page, and a $my_query = new WP_Query($args);
    loop, as suggested in the Codex, for PageOfPosts for the loop of the fetured category?

  6. MichaelH
    Member
    Posted 4 years ago #

  7. maorb
    Member
    Posted 4 years ago #

    Oh yeah :) How could I forgot the get_posts() function.. I've done such a thing before
    Thanks, that's really better than adding a new WP_Query();. Isn't it?

  8. MichaelH
    Member
    Posted 4 years ago #

    I agree, it seems simpler.

Topic Closed

This topic has been closed to new replies.

About this Topic