Treehouse: Grow your CSS skills. Land your dream job.

Have a WordPress update feed on a static HTML page?

  • # July 20, 2009 at 9:24 am

    Hello, all–

    My current client is looking for the following: Her actual site is in static HTML with a link to her WP blog that is on her domain. But, she also wants, on the static HTML homepage of her site, to have a little "Feed" of the most recent update to her blog (including upcoming shows, etc.) that would only feed if she uses a certain tag in WP when creating her post.

    Does this make sense, and is this possible? Probably using PHP or something, I assume.

    And just for the record, she doesn’t want the whole site built in WP, just the blog and the ability to feed recent posts from the blog to the home page.

    Thanks for any help!


    # July 20, 2009 at 12:08 pm

    It’s a much, much better idea to do the whole site in WordPress, so many advantages and no disadvantages, I would talk her into it.
    Otherwise simplepie is your best bet

    # July 21, 2009 at 6:41 am

    Thanks for the reply, Apostrophe. Right now, though, her current site is built (has been for about 6 months now) and I was hoping to avoid doing a complete conversion over to WP. This was just something she was asking about. I’ll take a look at the Simplepie site.

    Anyone else have any ideas? Some PHP perhaps?

    # July 21, 2009 at 10:58 am

    I have a ststaic site that links into a wordpress directory, and my homepage shows an excerpt from the wordpress

    if that is what you want, then let me know

    # July 21, 2009 at 1:49 pm

    Thanks, ikthius. I PM’d you to pick your brain!

    # July 22, 2009 at 11:03 am

    The easiest way is SimplePie.

    Use this url as the rss feed for your site

    # July 22, 2009 at 12:48 pm

    Some really good ideas posted so far in this thread, so I thought I’d add another one to the mix:

    You can actually do this by adding only some Javascript to your existing HTML (through the magic of jQuery). There is even a jQuery plugin to make this process easier –

    Example (courtesy of GitHub):

    < !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">

    jFeed – jQuery feed parser plugin – example

    # July 23, 2009 at 6:53 am

    here is what you need if your wordpress is on the same domain/server

    put this to the very top of your index page and call your index page index.php (this is your static page not in wordpress)

    < ?php // Include WordPress define('WP_USE_THEMES', false); //or true up to you require('/address-to-wp-blog-header-from-your-site/wp-blog-header.php'); query_posts('showposts=1'); ?>

    NOTE: the require is not correct as this is not the correct address, but explains where you should find the blog header, i.e. /data1/fplinux129/user/
    (above is totally made up example of where it sits)

    add this bit to where you want your exceprpt


    < ?php while (have_posts()): the_post(); ?>

    < ?php the_title(); ?>

    < ?php the_excerpt(); ?>

    ” class=”text1″>Read more…

    < ?php endwhile; ?>

    # November 12, 2009 at 2:27 am

    I’m doing something similar on a site that I’m working on. I’m including two loops, though. I tested it and it works fine. One of the loops just shows one post and the other loop shows two. Is there any code I can add to exclude the latest post on my second loop? I’m not very familiar with PHP but I was thinking there could be something I could add to this snippet:

    < ?php define('WP_USE_THEMES', false); require('../blog/wp-blog-header.php'); query_posts('showposts=2'); ?>
    # November 12, 2009 at 10:11 am

    I found out how to do this:

    query_posts(‘showposts=5&offset=1′); // Second loop, we get 5 posts excluding the most recent.
    if (have_posts()) :
    while (have_posts()) : the_post(); ?>
    // WordPress loop
    endif; ?>


Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.