Im running a specific wp_query to show the thumbnails in a slider of a specific category.
<?php $the_query = new WP_Query ('showposts=2', 'category_name=Events'); ?>
This doesnt appear to be working, am i missing array at the beginning somewhere
<?php $the_query = new WP_Query array('showposts=2', 'category_name=Events'); ?>
the above seemed to crash it.
Any advice would be great.
Use either:
or
// EDIT
Please note that
category_name
actually is the category slug (which is for one-word names originally the same). It is not the actual name (maybe having spaces, special characters etc. in it), though. In your case, where you just want to specifiy a certain category, you can do this either by means of the ID (cat=42
) or the slug (category_name=events
).If you really want/have to use the name, you have to use
get_cat_ID('Category Name')
, for instance like so: