I have 22 genres in my movie page that I am designing in Wordpress and with some PHP. Basically rather than me typing out 22 different taxonomy pages e.g. taxonomy-genre-action.php
to taxonomy-genre-western.php
I am going to use a template genre-template
.
But what I don't understand is how do I get the value/destination of a hyperlink to change two values on the genre-template
page e.g.
<?php
$args = array(
'post_type' => 'movies',
'orderby' => 'name',
'order' => 'ASC',
'posts_per_page' => -1,
'tax_query' => array(
array(
'taxonomy' => 'genre',
'field' => 'slug',
'terms' => 'action' // [CHANGE HERE]
)
)
);
?>
<h2 style="color: white">action movies</h2> <!-- [CHANGE HERE] -->
Change the 'action' value to whatever hyperlink to the other 21 genres are.
<a href="/wordpress/genre/<?php echo $args[$termCount]; ?>"><?php echo $args[$termCount]; ?></a>
How would I add the $args[$termcount]
value to the genre-template.php