• hi all i have a site that is currently my frontend and i want to sue wordpress for it’s posts only NO side menus or anything and need to include just this bit:

    http://i46.tinypic.com/332uxwh.png

    i know it can be done like the below code but that is for showing the post archives

    <?php
        // turn off WordPress themes and include the WordPress core:
        define('WP_USE_THEMES', false);
        require($_SERVER['DOCUMENT_ROOT'] . '/at/wp/wp-blog-header.php');
    ?></p>
    
    <p><?php wp_get_archives('type=monthly'); ?>
Viewing 6 replies - 1 through 6 (of 6 total)
  • You can copy the entire source code of a page of your site into an HTML editor and remove the content and sidebar divs, and replace them with your own. That’s a pretty easy way to make a static page that looks like your WP theme.

    Also, if you can use wp_get_archives(‘type=monthly’) then I’d imagine you could also use query_posts()

    Thread Starter steve51184

    (@steve51184)

    yeah static won’t work as i’ll need to re do it for every new post i make

    also about query_posts() how do i use that in the above code instead of wp_get_archives(‘type=monthly’) thanks

    http://codex.ww.wp.xz.cn/Template_Tags/query_posts

    Sorry I forgot that you don’t want a static page. Another way to do it is to use conditional code in your theme so that one of the pages does not display the sidebar, and the content div gets wider (if necessary).

    Thread Starter steve51184

    (@steve51184)

    ok i’m a little lost now i did this but all i get is a blank page:

    <?php
    // turn off WordPress themes and include the WordPress core:
    define(‘WP_USE_THEMES’, false);
    require($_SERVER[‘DOCUMENT_ROOT’] . ‘/at/wp/wp-blog-header.php’);
    ?></p>

    <?php

    //The Query
    query_posts(‘posts_per_page=5’);

    //The Loop
    if ( have_posts() ) : while ( have_posts() ) : the_post();

    endwhile; else:

    endif;

    //Reset Query
    wp_reset_query();

    ?>

    remember that the path

    ['DOCUMENT_ROOT'] . '/at/wp/wp-blog-header.php

    has to be correct for your site

    why do you have that </p> in there?

    What about something like;

    <?php
    $the_query = new WP_Query('showposts=5');
    while ($the_query->have_posts()) : $the_query->the_post();
    $do_not_duplicate = $post->ID;  ?>

    or maybe

    <?php if (have_posts()) : ?>
    <?php
    query_posts('showposts=5');
    <?php while (have_posts()) : the_post(); ?>

    and the rest of your loop code up to:

    <?php endif; ?>

    Well that second one is obviously wrong but I’m getting to the point where I can’t write any more code tonight.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘how do i include wordpress posts on a none wordpress site?’ is closed to new replies.