I’m showing posts of the term ‘football’ belonging to the taxonomy ‘section’, and everything works perfectly but
Where can I specify the number of posts I want to show?
just like this: ‘showposts’ => 3
I do not know where to put it
$myquery['tax_query'] = array(
array(
'taxonomy' => 'section',
'terms' => array('futbol'),
'field' => 'slug',
),
);
query_posts($myquery);
Never user
query_posts
, under any circumstances. UseWP_Query
instead, which is how query_posts works internally, but without the trickery and downsides.You’ll also find that the WP_Query documentation gives you explanations for every parameter, including what you are trying to do:
Including an example:
or as i would put it:
Notice how the main loop is the same as when using query_posts, only I’ve added
$query->
to the beginning ofhave_posts
andthe_post
?You can now modify the parameters to add in your tax query
http://codex.wordpress.org/Class_Reference/WP_Query
You want
posts_per_page
instead:This works, thanks Tom 🙂