WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Latest Post on Front Page

[Resolved] Latest Post on Front Page

  • 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.

Viewing 15 replies - 1 through 15 (of 16 total)
  • Please post in this one, I had double posted by accident.

    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?

    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.

    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?

    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.

    Thanks Kafkaesqui. I’ll study both options.

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

    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.

    Any thoughts?

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

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

    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.

    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

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

    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.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘[Resolved] Latest Post on Front Page’ is closed to new replies.
Skip to toolbar