Created
June 29, 2013 18:33
-
-
Save wpspeak/5892166 to your computer and use it in GitHub Desktop.
Link post title to external link - works best for link post format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Link post title to external link | |
function afn_link_filter($link, $post) { | |
if (has_post_format('link', $post) && get_post_meta($post->ID, 'LinkFormatURL', true)) { | |
$link = get_post_meta($post->ID, 'LinkFormatURL', true); | |
} | |
return $link; | |
} | |
add_filter('post_link', 'afn_link_filter', 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment