Displaying Latest Blog Entries on Home Page (WordPress)

Discussion in 'WordPress' started by nohaber, Oct 29, 2005.

  1. #1
    I need a plugin for WordPress, that can display the titles/first words of the latest blog entries. The blog is on a subdomain and I want these latest entries to be displayed on the main home page.
    I searched for such a plugin but couldn't find one.

    Anyone know of some ready-made one?
     
    nohaber, Oct 29, 2005 IP
  2. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #2
    If you want it to display outside the blog, a WordPress plug-in isn't going to do much for you I don't think. Probably easier just to query the WP database directly.
     
    digitalpoint, Oct 29, 2005 IP
  3. nohaber

    nohaber Well-Known Member

    Messages:
    276
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    138
    #3
    Shawn, you are right. I just don't want to write it myself, but I'll have to if no one points to an already-written solution.
     
    nohaber, Oct 29, 2005 IP
  4. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #4
    I don't know of anything, but here's a query that will get all the info you need for the 5 most recent posts...

    SELECT post_title,post_name FROM wp_posts ORDER BY post_date DESC LIMIT 5;
    Code (sql):
     
    digitalpoint, Oct 29, 2005 IP
  5. WhatiFind

    WhatiFind offline

    Messages:
    1,789
    Likes Received:
    257
    Best Answers:
    0
    Trophy Points:
    180
    #5
    WhatiFind, Oct 29, 2005 IP
  6. ozgression

    ozgression Well-Known Member

    Messages:
    343
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    140
    #6
    Yeah, use magpierss to display your rss feed on your front page.
     
    ozgression, Oct 29, 2005 IP
  7. nohaber

    nohaber Well-Known Member

    Messages:
    276
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    138
    #7
    Thanks for the tips. Actually, it turned out to be easy. I just put a php file in the blog subdomain and include it from the main page. If someone is interested here's the code I use:
    <?php
    
    require_once( dirname(__FILE__) . '/wp-config.php');
    $title_was_printed = false;
    
    $posts = get_posts('numberposts=3');
    foreach ($posts as $post) :
    if ($title_was_printed == false) {$title_was_printed = true; print "<h1>Latest SEO Blog Entries</h1>";}
    ?>
    
    <p><a href="<?php the_permalink() ?>" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a> -
    <small><?php the_time('l, F jS, Y') ?> - Posted in <?php the_category(', ') ?></small></p>
    
    <?php
    endforeach;
    
    if ($title_was_printed == true) {
    ?>
    <p align=right style="margin:0px; padding: 0px;"><a href="http://blog.seoguide.org"><b>&raquo;&raquo; Read The SEO Blog &laquo;&laquo;</b></a></p>
    
    <?php } ?>
    Code (markup):
    It works well on my home page http://www.seoguide.org
     
    nohaber, Oct 29, 2005 IP
  8. LcF

    LcF Peon

    Messages:
    73
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Thank you! It is simple and it works! :)
     
    LcF, Dec 24, 2005 IP
  9. sputnik

    sputnik Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Haber,

    I tried this, but get the following error (I'm using WordPress 2.0 by the way):

    Fatal error: Call to a member function get_row() on a non-object in /blog/wp-includes/functions.php on line 281

    I'm stuck. Any clues?

    Thanks,

    Dave
     
    sputnik, Jan 27, 2006 IP
  10. ServerUnion

    ServerUnion Peon

    Messages:
    3,611
    Likes Received:
    296
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Why not just consume the RSS feed. I do that on many of my sites and it works great.
     
    ServerUnion, Jan 27, 2006 IP
  11. sputnik

    sputnik Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Well, I could look at that can of worms next, but I've finally gotten the lid off this can...

    I guess because I'm not sure how much I can customize the RSS feed relative to what I want to appear on my home page. I have a standard RSS feed, but I want titles, dates & possibly a short summary only on the home page.

    Come to think of it I probably should consider this...

    Anyway I did figure out the problem I posted about. I had to include wp-config.php at a higher level than on the specific page I was working on. I added it to our standardincludes.php file and all is well.
     
    sputnik, Jan 27, 2006 IP
  12. Grant

    Grant Active Member

    Messages:
    224
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #12
    ServerUnion,

    Can you provide a little more detail or link about that. I am interested.
     
    Grant, Jan 27, 2006 IP