New Posts
Live Radio
Welcome guest, is this your first visit?
  • Login:
Redbet.com Affiliate Program
+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Man of Leisure
    I'm not really Tony Danza.
     

    Add as a friend
    Join Date
    Nov 2008
    Location
    ATL
    Posts
    258
    Blog Entries
    3
    Feedback Score
    5 (100%)

    Default Importing Wordpress Posts to Homepage

    I am looking for a way to call in the recent posts from my blog on my site to the homepage of my site. The blog is wordpress and the site is html/php.

    Any help would be much appreciated

  2. #2
    MmS
    MmS is offline
    Member
    My Status
     

    Add as a friend
    Join Date
    Nov 2008
    Location
    Netherlands
    Posts
    34
    Feedback Score
    3 (100%)

    Default

    I use something like this:

    PHP Code:
    <?php
    $args
    =array('showposts'=>8,'caller_get_posts'=>
    );$my_query = new WP_Query($args);
    if( 
    $my_query->have_posts() ) {
    while (
    $my_query->have_posts()) : $my_query->the_post(); ?>
    <li><a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
    <?php endwhile;}?>

  3. #3
    #!/usr/bin/mikebrad
    My Status
     

    Add as a friend
    Join Date
    Nov 2008
    Location
    USA
    Posts
    697
    Feedback Score
    8 (100%)

    Default

    That will only work if you are inside of wordpress. Functions like WP_Query and the_post only work inside of the wordpress installation.

    I believe you need to include the wp-load.php file and a template referrence to make the above code work. The template referrence prevents the entire wordpress theme from loading and the wp-load.php file pulls in the wp-config and associated functions for wordpress.

    PHP Code:
    define('WP_USE_THEMES'false);
    require(
    './blog/wp-load.php');  //<---Change to your path to wp 
    put that code in the header section of the homepage

  4. #4
    Man of Leisure
    I'm not really Tony Danza.
     

    Add as a friend
    Join Date
    Nov 2008
    Location
    ATL
    Posts
    258
    Blog Entries
    3
    Feedback Score
    5 (100%)

    Default

    Thanks guys, will get crackin on this


 

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Help needed importing data into MySQL database
    By TheShortStack in forum Wordpress - Web Design - Coding - Technical
    Replies: 4
    Last Post: 06-10-2010, 11:01 AM
  2. Importing CSV files into PHPMyAdmin
    By TheShortStack in forum Wordpress - Web Design - Coding - Technical
    Replies: 5
    Last Post: 05-16-2010, 05:29 PM
  3. Automatic CTA on all wordpress posts
    By addz123 in forum Wordpress - Web Design - Coding - Technical
    Replies: 11
    Last Post: 05-06-2010, 08:56 AM
  4. Organising posts in wordpress
    By pokerextras in forum Wordpress - Web Design - Coding - Technical
    Replies: 0
    Last Post: 04-29-2010, 05:00 PM
  5. WTS PR4 Homepage Link & Blog Posts
    By Josh in forum Advertising
    Replies: 0
    Last Post: 11-03-2009, 03:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Powered by vBulletin® Version 4.1.5
Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.
SEO by vBSEO 3.6.0
Affiliate Program Consultant