I have set up a feed in a larger page template the lists the most recent posts from a custom post type and belong to a custom taxonomy
e.g. (in this case) a feed listing the most recent video testimonials. (custom post type = testimonials, custom taxonomy = testimonials_cat, slug = video).
I want to add a link that says “view all video testimonials” which would link to a ‘taxonomies-testimonials_cat.php’ (that I’ve already created) displaying all video testimonials.
My question is how do I generate the link? And where do I put it?
From a design point of view I would like the link to be placed directly after section <h3>title</h3>
(where i have marked in the code <?php GET_LINK_TO_ARCHIVE_PAGE ?>
).
Thanks
Here is my code for the WP_Query loop and HTML:
<!-- VIDEO TESTIMONIALS -->
<div class="row"><div class="col-md-12"><h3><?php the_field('title_2'); ?></h3>
<a href="<?php GET_LINK_TO_ARCHIVE_PAGE ?>">View all video testimonials...</a>
</div></div>
<div class="row">
<!-- VIDEO ARGS -->
<?php
$args = array(
'post_type' => 'testimonials',
'tax_query' => array(
array(
'taxonomy' => 'testimonials_cat',
'field' => 'slug',
'terms' => 'video'
)),
'orderby' => 'date',
'posts_per_page' => 4
);
$videos = new WP_Query( $args ); ?>
<!-- VIDEO FEED -->
<?php if ( $videos->have_posts() ) : ?>
<?php while ( $videos->have_posts() ) : $videos->the_post(); ?>
<div class="post-wrapper testimonials video col-sm-3" id="post-<?php the_ID(); ?>">
<h2 class="post-title"><?php the_title(); ?></h2>
<?php the_field('video'); ?>
</div><!-- end of post wrapper -->
<?php endwhile; ?>
<!-- if no post found -->
<?php else: ?>
<div class="col-md-12"><h3><?php _e('Sorry, no posts matched your criteria.'); ?></h3></div>
<?php endif; wp_reset_query(); ?>
<!--/ end of WP loop -->
</div><!-- end of row -->
<hr>