SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Jul 2008
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to fatch wordpress blog entries title in website pages

    Hello Friends,

    I am bit confuse that having problem to fatch my wordpress blog entries on my website pages. I want to fatch Latest 10 blog entries title and want to link from my pages. But I am unable to find any code for this. Can any body help me and show me the code.

    Thanks

  2. #2
    SitePoint Wizard ryanhellyer's Avatar
    Join Date
    Oct 2006
    Location
    New Zealand
    Posts
    2,323
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Garry,
    You need to add the following to your pages to call WordPress functions outside of WordPress itself.

    PHP Code:
    require('../../../wp-blog-header.php'); 
    Once you have that added, you should be able to use regular WordPress loops I think. Although I haven't tried this myself. Another route would be to render a page in WordPress with just the HTML you want to add for your latest posts section, then include that in your non-Wordpress pages.

  3. #3
    SitePoint Enthusiast websavy's Avatar
    Join Date
    May 2008
    Posts
    87
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ryanhellyer View Post
    Hi Garry,
    You need to add the following to your pages to call WordPress functions outside of WordPress itself.

    PHP Code:
    require('../../../wp-blog-header.php'); 
    Once you have that added, you should be able to use regular WordPress loops I think. Although I haven't tried this myself. Another route would be to render a page in WordPress with just the HTML you want to add for your latest posts section, then include that in your non-Wordpress pages.
    The process is not clear for me so please explain it little more.

  4. #4
    SitePoint Wizard ryanhellyer's Avatar
    Join Date
    Oct 2006
    Location
    New Zealand
    Posts
    2,323
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm assuming here that your 'website' is run via PHP and you know what a WordPress loop is and how to manipulate them. If not, let me know and we'll need to start from a more simpler level.

    Basically you just add the call to wp-blog-header.php to the top of your PHP script. The script hooks into all of the various WordPress functions etc. and should allow you to use all of the regular WordPress functionality. It is called automatically by WordPress, hence you don't need to use it in WordPress powered sites.

    Then you add a WordPress loop to the part of your pages you want the loop to appear.

    And bingo, the WordPress loop will appear - or at least I think it should. I've never tried doing this. All of my loops are run from within WordPress itself so I haven't needed to use this approach before.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •