Skip to content

Instantly share code, notes, and snippets.

@webmasterninjay
Last active August 29, 2015 14:23
Show Gist options
  • Save webmasterninjay/7a8ad754fade90ac4701 to your computer and use it in GitHub Desktop.
Save webmasterninjay/7a8ad754fade90ac4701 to your computer and use it in GitHub Desktop.
WP Genesis: Add external link on Post Title
<?php
// Filter post title
// to add custom url, just add a custom field with name ExternalURL and url as value where you want the title to go when clicked
add_filter( 'genesis_post_title_output', 'jay_post_title_output', 15 );
function jay_post_title_output( $title ) {
if ( is_singular() && get_post_meta( get_the_ID(), 'ExternalURL', true) )
$exturl = get_post_meta( get_the_ID(), 'ExternalURL', true);
$title = sprintf( '<h1 class="entry-title"><a href="%s" title="%s" target="_blank">%s</a></h1>', $exturl, get_the_title(), get_the_title() );
return $title;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment