0
votes

I need to get some posts by category and display them out of the wordpress. I need these posts hidden in the wp blog. But visible in my custom page. Via php.

I'm noob with wordpress. Can anyone direct me about how can I do that?

1

1 Answers

0
votes

Your file should be something like this:

<?php

require '/path/to/wordpress/root/wp-load.php';

$the_query = new WP_Query( 'post_status=private' );
while ( $the_query->have_posts() ) : $the_query->the_post();
    echo '<li>';
    the_title();
    echo '</li>';
endwhile;

?>

Read more about WP_Query class to get posts which you need.