• So I’m trying to list all the posts within a category and it doesn’t seem to be working. This is what i’ve got.

    This code on the page I would like the posts to be listed on.

    <?php get_posts($news); ?>

    This code within my functions.php. Any idea whats up?

    <?php $news = array(
    	'posts_per_page'   => 5,
    	'offset'           => 0,
    	'category'         => '3',
    	'category_name'    => '',
    	'orderby'          => 'date',
    	'order'            => 'DESC',
    	'include'          => '',
    	'exclude'          => '',
    	'meta_key'         => '',
    	'meta_value'       => '',
    	'post_type'        => 'post',
    	'post_mime_type'   => '',
    	'post_parent'      => '',
    	'author'	   => '',
    	'post_status'      => 'publish',
    	'suppress_filters' => true
    );
    $posts_array = get_posts( $news ); ?>
  • The topic ‘Trying to list posts with get_posts();’ is closed to new replies.