I have these pages: Germany, Argentina, Brazil. When viewing any of these I need a Custom Loop that queries for News (Custom Post Type) AND queries for Country (Taxonomy).
The page slug is exactly as the taxonomy. How could i pass the page slug as a Variable and insert it as an argument inside a WP Query? Thanks in advance!
<?php $loop = new WP_Query(array
('post_type' => 'news',
'country' => $CurrentPageSlug, //-------> HELP!
'posts_per_page' => 3)); ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<?php endwhile; ?>
As i understand i think you want to detect the page name, this is how you can do.
Then pass this
$pagename
in WP_Query arguments.