Home » Latest WP News

Trying To Have My Website Show Latest Posts From My WordPress Blog? How Do I Do It?

I have a word press blog and a website. These are two distinct sites. The website is written in PHP and i am trying to get the latest say 5 posts from the blog to appear in a short format in the site? Any suggestions??
Please help!

Tags: , , , , , , , ,

Latest Wordpress Themes

  • Brest - Magazine WordPress Theme
  • Moderna WP Template - Web, Software, Hosting
  • Chromonium Business Template Wordpress
  • Paper Plane Wordpress Theme
  • Premium Company Template - Wordpress 3.0
  • Collective - Community WordPress Theme
  • UMBOOM - business, blog, portfolio theme
  • Geronimo - One page portfolio & business theme
  • Alabastros Studios Wordpress Version
  • BluePrint Magazine
  • DotMobi - WordPess Theme for Mobile Devices
  • Business WordPress Theme created by professionals
  • Pang - Business and Corporate Wordpress Template
  • Blackops - Porfolio & Blog
  • The Developer WP3 Edition
  • Premium Football - 32 in 1
  • Eunice - Business, Blog, Portfolio Wordpress Theme
  • Sheets Wordpress Theme

2 Comments »

  • mohdhazw said:

    Simple ways is to pull RSS from your blog.
    You can check out herehttp://www.feedforall.com/more-php.htm
    All the besst :)

  • Rounder said:

    “I have removed the default styling as myself like most people tend to use their own DIVS, h1, h2, etc, and so it’s easier to just apply your DIV’s and other styling to the core functioning of the code.
    $yoursitename_posts_to_show is a numerical variable passed from where you call the function
    Change “yoursitename” throughout the function to something unique to avoid dupe var names in WordPress. I use my site name as WordPress wont have used it
    //DISPLAY LAST X POSTS
    function last_xx_posts($yoursitename_posts_to_sho…
    if (is_numeric($yoursitename_posts_to_show)…
    /* gets number of recent posts limited by the number
    you assign to the variable */
    query_posts(‘showposts=’.$yoursitename…
    if (have_posts()) :
    /*
    This shows the var (numerical) you set of number of posts to show
    If you will ever show only ONE (1) last recent post, you will need
    to add some PHP to allow for “Last 1 post” (not “postS”)
    /*
    echo ‘Last ‘.$yoursitename_posts_to_show.’ most recent posts’;
    while (have_posts()) : the_post(); ?>

    ” rel=”bookmark” title=”< ?php the_title(); ?>“>< ?php the_title(); ?>

    < ?php the_time('l, F jS, Y'); ?>

    By: < ?php the_author_link(); ?>

    < ?php the_content("Continue Reading – ” . the_title(”, ”, false).”…”); ?>
    < ?php
    endwhile; //end loop of all posts
    endif; //end if have posts
    endif; //end if variable is numeric
    }//end function
    ?>To use this function, copy and paste the above in your wp-content/themes/yourtheme/functions.ph… file
    If you don’t have this file you can just make one
    Read about that herehttp://codex.wordpress.org/Theme_Develop…
    Then simply use the following code in any of your template files
    < ?php
    //show last 5 posts
    $yoursitename_posts_to_show = 5;
    last_xx_posts($yoursitename_posts_to_s…
    ?>Set the “5″ to however many you want to show.
    ***IMPORTANT NOTES***
    NOTE A
    DO NOT call this function with the above code in ANY file where “The_Loop” has already been used.
    That is:
    < ?php if (have_posts()) :
    while (have_posts()) : the_post(); ?>This includes of course index.php, archive.php, etc
    Although, I found I didn’t want to anyway as these files already have a bunch of posts, and in single.php the post comments are under the article and that tends to be enough for one page!
    Use this code somewhere such as at the bottom of your 404 and perhaps like me you have “pages” like “about this site” that usually
    don’t have any articles or posts or comments, so using this you can have the last x most recent
    NOTE B
    THIS WILL override your “Blog pages show at most” setting in Admin -> Settings -> Reading.
    So if you set 3 most on one page there, and use the function to display the last 5 posts, it WILL display the last 5 posts!”

Watch Wordpress Training Videos