WordPress.org

Support

Support » Installation » Titles for last 6 articles on another non-WP page

Titles for last 6 articles on another non-WP page

  • I’ve set up the site so the main directory is a static page that I’ve plugged the search box into and the WordPress is in a folder called ‘sub’. I’m easily calling the search box functionality for the blog on my home page but I can’t seem to work out how to —

    call the last 6 post titles onto the home page …

    I would have thought simply calling the included function from wp-include would get that working too. But it doesn’t seem to work..

    Has anyone here done this recently?? The homepage is just one folder up after all and there’s no logical reason that it shouldn’t just be a walk in the park.. any help or advice would be appreciated.

    (Sorry I meant to post this in the next forum not Installation oops – could someone bump it maybe?? Don’t want to double post)

Viewing 10 replies - 1 through 10 (of 10 total)
  • You don’t even need to do as much work as that.
    Just add the following to your home page.
    <form id="searchform" method="get" action="http://yourdomain.com/sub/index.php">
    <input type="text" name="s" size="20" value="search" />
    </form>

    You’ll also need to include this line at the top of the file:

    <?php
    require('./sub/wp-blog-header.php');
    ?>

    Then you can include the function call. Remember to change the extension of the file to .php so the server knows that it’s going to have to parse some PHP!

    Yeh I just called the searchform like with a relative address, that was fine. I called the special chars function with an include statement, sorry I was probably vague. The search box has no issues at all.

    Putting a require to wp-blog-header makes the search form die a horrible and yukky death… but as i said the search funtion works fine..

    What I want to do though is to call the permalink titles onto the page, about 6 or so, to pull people into the blog. The whole rest of the site is actually in the WordPress folder called ‘sub’.

    I’ve tried a couple of things and still giving it a go but before I spend a week trolling the PHP I thought someone might be able to steer me right a bit… it must be a common functionality when blogs are included in sites. This is a free redesign for a Japanese NPO called PC4Peace.org, too, by the way so its a good cause.

    Mmm think I’ll just do it the old fashioned way and call the 6 most recent article titles from the database…

    rule 1: I must never make things more complicated

    Elegant design!
    Made it yourself or is it a theme?

    ??? Design?? Do you mean the up there yuk PC4Peace.org site??

    Or the wordpress redesign thats on my domain??

    Or Pig Work (which is my blog??)

    Pig work, Porco!

    Swell work. Pigs will be very proud!! 🙂

    Oh that’s just a 1.2 integration, the same with pigpen..

    Porco –

    If you searched around a bit here, some people have found using an RSS aggregator (like my CG-FeedRead) to pull in the latest headlines off their own feed into another non-WP page to be a decent approach. That way you aren’t calling WP constantly (feed gets cached — could be ‘stale’ for a little bit, but then doesn’t hit db every pageload… 😉 ).

    -d

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Titles for last 6 articles on another non-WP page’ is closed to new replies.