pdxsherpa — 2014-06-13T18:03:03-04:00 — #1
$new_query = new WP_Query('category_name=news','category_name=cta' )
Doesn't seem to work
searched the codex but so far have not seen an answer.
Has anyone here run into this? how can i call multiple categories please?
palaceofthemes — 2014-06-16T00:40:35-04:00 — #2
Hi, why don't use this Content Views plugin http://wordpress.org/plugins/content-views-query-and-display-post-page/
It is easy to query post(s) by multiple categories, without coding!
It even offers you more awesome features
Hope this helps
pdxsherpa — 2014-06-16T23:07:34-04:00 — #3
Hello Place. Yes you are right it probablly would be easier to use plugins (& i have for contact forms) but I think it is always better to be able to understand how to create things yourself as much as possible.
A bit like the difference between being able to create a piece of art or a remarkable dinner versus buying one or buying a frozen entree. ((which i have also have done... take out is better really)
palaceofthemes — 2014-06-17T05:33:24-04:00 — #4
As in your first post, you want to query 2 categories: news, cta.
So this is the query for you (if you want to code yourself):
$args = array(
'post_type' => 'post',
'tax_query' => array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => array( 'news', 'cta' )
$query = new WP_Query( $args );
pdxsherpa — 2014-06-18T09:51:35-04:00 — #5
That is an interesting solution Theme, might try it out but was thinking there should have been a more direct way. this is what i currently have
This simple line uses the post/page number to for href. so far so good
<p><ahref="index.php?p=13" target="_blank" class="btn btn-primary special">tech</a></p>
And this is what i use to call one category. I think i just tried doubling that parameter and it didn't work.
$new_query = new WP_Query('category_name=tech' );
while ( $new_query->have_posts() ) : $new_query->the_post();
<h5><a href="<?php the_permalink(); ?>" class="btn btn-primary special"><?php the_title(); ?></a></h5>
<?php endwhile; ?>