WordPress.org

Ready to get started?Download WordPress

Forums

Titles for last 6 articles on another non-WP page (11 posts)

  1. porco
    Member
    Posted 9 years ago #

    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)

  2. ifelse
    Member
    Posted 9 years ago #

    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>

  3. Avenir
    Member
    Posted 9 years ago #

    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!

  4. porco
    Member
    Posted 9 years ago #

    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.

  5. porco
    Member
    Posted 9 years ago #

    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

  6. S.K
    Member
    Posted 9 years ago #

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

  7. porco
    Member
    Posted 9 years ago #

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

    Or the wordpress redesign thats on my domain??

  8. porco
    Member
    Posted 9 years ago #

    Or Pig Work (which is my blog??)

  9. S.K
    Member
    Posted 9 years ago #

    Pig work, Porco!

    Swell work. Pigs will be very proud!! :)

  10. porco
    Member
    Posted 9 years ago #

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

  11. davidchait
    Member
    Posted 9 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.