Support » Plugins » Show posts in a completly different php script?

  • Well, what i want to do is show the 5 or so most reason posts, including titles in a different PHP script.

    How do i do this?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter niddy

    (@niddy)

    that’s just too logical, im very grateful again, Kafkaesqui =)

    Thread Starter niddy

    (@niddy)

    Im sorry but i can’t seem to make it work.

    I want to show the posts i’ve posted on the frontpage in another php script on another page (not within wordpress, although on the same server), how do i do this?

    <?php
    define('WP_USE_THEMES', false);
    require('/locale/of/my/wp-blog-header.php');
    query_posts('showposts=5');
    while( have_posts() ) : the_post();
    ?>
    <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    <?php the_content(); ?>

    <?php endwhile; ?>

    This works fine for me. It should work fine for you as well, as long as A. the path to wp-blog-header.php is correct, and B. there are no potential conflicting db connections (i.e. you include another PHP application that has its own database).

    Thread Starter niddy

    (@niddy)

    Im really really impressed by the help i get here at wordpress. It’s probably the best i’ve gotten from any forum so far.

    Thread Starter niddy

    (@niddy)

    Just got it to work:

    <?php
    define(‘WP_USE_THEMES’, false);
    require(‘wp-blog-header.php’);

    query_posts(‘showposts=3 &cat=21‘);
    while( have_posts() ) : the_post();
    ?>

    <h2>“><?php the_title(); ?></h2>
    <?php the_content(); ?>

    <?php endwhile; ?>

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Show posts in a completly different php script?’ is closed to new replies.