WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Latest Post on Front Page (17 posts)

  1. Syni
    Member
    Posted 8 years ago #

    Well, I've been beating my head against the wall for some time trying to find an answer to this, but here it goes, I'm using the Semiologic Static Front Page Plugin or trying to at least. Here's the thing, half the content will be static while the other will be dynamic and I want to get the dynamic content done first.

    I hope this is easy. At the top of the page, I need a loop that will show the newest post from _any_ category. I've created my own home.php file and have edited it accordingly, copying index.php's content, but even that won't show up on the home page I specified. So I'm really at a loss as to what to do.

  2. Syni
    Member
    Posted 8 years ago #

    Please post in this one, I had double posted by accident.

  3. Kafkaesqui

    Posted 8 years ago #

    Just to make sure I understand: You want a Page displayed as your home page, but you want a single post (the latest) to appear before any Page content?

  4. Syni
    Member
    Posted 8 years ago #

    Yes. It'll be better if I illustrate: http://www.avalonstar.com/trash/1.gif
    Everything below the blue line will be static (at least per my plans) and that top post will be dynamic.

  5. amory
    Member
    Posted 8 years ago #

    I don't know how the semiologic plugin works, but couldn't you simply use the home.php template, run the loop to display the latest post, and put whatever static content you want in after the loop?

  6. Kafkaesqui

    Posted 8 years ago #

    Two ways I can suggest to do this:

    1. Create a Page template you assign to your "home" Page. Within that Page template you want to set up two distinct Loops. The latter one (for your Page content) remains as normal. For your post loop, use the second or third examples displayed under Multiple Loops Version 1 (on the Codex page covering The Loop).

    2. Without Static Front Page, create a home.php (duplicating index.php). In this, either set up WordPress to display one post per page, or initialize the post loop with query_posts() (as seen in 2nd example mentioned above) and a parameter of 'showposts=1'. Then to display the Page content, use a plugin of mine, or do something like the following:

    <?php $homePage = new WP_Query('page_id=###'); ?>
    <?php while($homePage->have_posts()) : $homePage->the_post(); ?>

    ~ Page content (i.e. template tags) you want displayed goes here ~

    <?php endwhile; ?>

    (Replace ### with the Page's numeric ID)

    Options...

    EDIT: In option 1 above I suggest to use either the second or third example here. In fact you should use the third one, as it avoids conflicts with other loops.

  7. Syni
    Member
    Posted 8 years ago #

    Thanks Kafkaesqui. I'll study both options.

  8. Syni
    Member
    Posted 8 years ago #

    I think I got it to work, thanks a lot for the help. :D

  9. Syni
    Member
    Posted 8 years ago #

    Wait... no it doesn't...

    If you go here: http://www.avalonstar.com/home ... it works.
    If you go here: http://www.avalonstar.com ... it doesn't.

  10. Syni
    Member
    Posted 8 years ago #

    Any thoughts?

  11. Syni
    Member
    Posted 8 years ago #

    I really want to see what this problem is, so I do want to bump this up.

  12. moshu
    Member
    Posted 8 years ago #

    You should describe which of the suggested solutions gives you the result you are complaining about. (And do NOT bump, please!)

  13. Syni
    Member
    Posted 8 years ago #

    Sorry moshu. To better explain. If you go to the 2nd link, where the home page is supposed to display, nothing shows up. The first link (when I go to the actual page I created) is what is supposed to display when going through the TLD.

    Make any sense? I apologize if it doesn't.

  14. moshu
    Member
    Posted 8 years ago #

    Read it carefully: in this thread there were mentioned at least 3 solutions for what you want. Which of them are you using?
    1. the Semiologic Static Front Page Plugin
    2. Kafkaesqui's solution 1
    3. Kafkaesqui's solution 2.
    4. Soemthing else
    5. All of the above

  15. Syni
    Member
    Posted 8 years ago #

    I'm using the Semiologic Plugin with Kafkaesqui's solution 1.

  16. Denis de Bernardy
    Member
    Posted 8 years ago #

    Syni, you should be editing the home.php file rather than defining a custom page template. indeed, the front page will be detected via is_home() and will display the home.php file accordingly.

    also, i think you cannot achieve what you explain you want to do with the static front page plugin. static front hijacks the main wp loop, and returns the 'home' page on the front page. if you reinitialize the loop before displaying the 'home' page, then you'll need to query for it again. thus, you'll want to either display the home page before your latest post(s) via a second loop, or use kaf's #2 solution.

  17. 3stripe
    Member
    Posted 8 years ago #

    Syni, did you work out how to fix this yet?

    I have exactly the same problem - when viewing http://www.deirdre-edwards.co.uk/index.php only my static content shows up, whilst http://www.deirdre-edwards.co.uk/home shows only the result of the loop...

    I think I'm going to plump for Kaf's #2 solution first... as usual I'm finding the whole loop concept confusing.

    EDIT. Cheers Kaf, it worked =) =) =)

Topic Closed

This topic has been closed to new replies.

About this Topic