I'm trying to do execute a query with multiple parameters and can't figure out how to properly format the query. There isn't any documentation on combining queries in codex.wordpress.
I need to have the following in the query:
- category id - to only show posts from a certain cateogry (or categories, array)
- number of posts per page
- order by date DESC
- exclude a post using a post id
Here is my attempt:
<?php
$query = new WP_Query('cat=4', array('posts_per_page' => '4'), array('orderby' => 'date','order' => 'DESC'));
if ($query->have_posts()) : while ( $query->have_posts()): $query->the_post(); ?>
<li><a href="<?php the_permalink() ?>">
</li>
<?php endwhile; else: ?>
<p>Sorry, nothing</p>
<?php endif; wp_reset_postdata(); ?>
Any help is appreciated! Thanks!