• Resolved macmiller

    (@macmiller)


    I’ve seen others ask this so I have an idea it can be done, but I really don’t know where to start. I’ve got an existing site out there: http://www.coolthaihouse.com and have installed and done some testing on a blog at http://www.coolthaihouse.com/blog. If you look at the coolthaihouse.com page (non wp) there is a section News and Happenings (on the left). I would like to pull 6 articles headlines along with the first sentence of the post and put them here. Can this be done? Any help is appreciated.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You can use this tag http://wiki.wordpress.org/get_posts
    Just modify it for your needs (i.e leave out the “offset”, change the “numberposts” to 6) and you are ready to go.
    Make sure you edit the excerpts of your posts, so that it shows the desired portion of the text. (If you do NOT put anything in the excerpt field, it will take a few line from the beginning of your posts.)

    Thread Starter macmiller

    (@macmiller)

    the get_posts is working perfectly. now i only have a question about how to get the date returned as a part of the post which i posted under a new thread.

    Try adding in the code that you got from the get_posts
    start_wp()
    ie, something like this (I hope it will show up 🙂
    <?php
    $posts = get_posts('numberposts=1&offset=0');
    foreach ($posts as $post) : start_wp(); ?>
    <?php the_date(); ?>
    " rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?>
    <?php the_excerpt(); ?>
    <?php
    endforeach;
    ?>

    Of course you can remove the permalink anchor, though it wouldn’t make too much sense.

    Thread Starter macmiller

    (@macmiller)

    yes that worked! I also found, interestingly, that a call to the_time returns a time with or without the start_wp.
    thankz.

    Glad that finally you worked out. Yes, it seems the_time works even outside The Loop

    update for the benefit of future visitors, blogging novices like me: if you want to include an RSS feed in an ordinary static webpage, it’s easily done. Just do a web search for “RSS javascript” (without the quotes) and you should find many many sites offering to generate a few lines of javascript that you can insert into an ordinary .html page. Works great so far.
    Here’s one site I like:
    http://jade.mcli.dist.maricopa.edu/feed/

    I have been using something like <?php $posts = get_posts('category=7&numberposts=1&order=DESC&offset=0'); foreach ($posts as $post) : ?> on my 1.3 development blog. It worked fine for a while and then it stopped. Anyone have any guesses as to what would make this happen? Maybe something with updated beta code…?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘pulling articles into a non wp page’ is closed to new replies.