I am working on a site where a relationship is being used to show 3 featured posts from multiple categories on the home page. There is a link below each set of 3 posts to link to the category, but there is a custom category page that I would like to link to rather than just linking to the main category. Is there a way to add a field for adding the custom links below the 3 featured posts?
This is the code that is in the template file:
<?php $homePosts = get_field( 'home_posts', 'option' );
$gridTaxonomies = $homePosts[ 'post_grids' ];
if ( $gridTaxonomies ) { ?>
<div class="home-grids">
<?php foreach( $gridTaxonomies as $gridTaxonomy ) : ?>
<h4 class="section-title"><?php echo $gridTaxonomy->name; ?></h4>
<?php $args = array(
'posts_per_page' => 3,
'post_type' => 'post',
'post_status' => 'publish',
'ignore_sticky_posts' => true,
'cat' => $gridTaxonomy->term_id,
);
$myQuery = new WP_Query( $args );
while ( $myQuery->have_posts() ) : $myQuery->the_post(); ?>
<article class="entry one-third <?php if( 0 == $myQuery->current_post % 3) echo 'first'; ?>">
<header class="entry-header">
<?php the_post_thumbnail( 'third-square' );
genesis_post_title(); ?>
</header>
</article>
<?php endwhile; ?>
<div class="clear"></div>
<?php echo PSB\render_more_link( get_category_link( $gridTaxonomy->term_id ), 'More ' . $gridTaxonomy->name );
endforeach; ?>
</div>
<?php }
This line:
<?php echo PSB\render_more_link( get_category_link( $gridTaxonomy->term_id ), 'More ' . $gridTaxonomy->name );
needs to actually use a custom link.
This is what the section looks like on the page
Any tips would be much appreciated!!