Skip to content

Instantly share code, notes, and snippets.

@anythinggraphic
Last active January 29, 2017 03:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anythinggraphic/87e173e0cf17732c222bb591a57c522f to your computer and use it in GitHub Desktop.
Save anythinggraphic/87e173e0cf17732c222bb591a57c522f to your computer and use it in GitHub Desktop.
Change the link on the entry-title for each post to a custom one on Archives page
<?php
/* @link https://anythinggraphic.net/change-entry-title-post-links-archives-genesis/
/* Change the link on the entry-title for each post to a custom one on Archives page
----------------------------------------------------------------------------------------*/
add_filter( 'genesis_post_title_output', 'ag_custom_post_title_link' );
function ag_custom_post_title_link( $title ) {
if( is_archive() ) {
$post_title = get_the_title( get_the_ID() );
$title = '<h2 class="entry-title" itemprop="headline"><a href="' . get_field('link') . '" target="new">' . $post_title . '</a></h2>';
}
return $title;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment