View Single Post
Old 04-13-2020, 04:54 AM  
seoguy
Confirmed User
 
Join Date: Nov 2004
Posts: 381
Actually the following works, but no matter how I implent it, I can't change "https://www.test.com" to the custom field ExternalUrl, what am I doing wrong?

$externalurl = get_post_meta( get_the_ID(), 'ExternalUrl', true);
if( ! empty( $externalurl) ) {
$externalurl = get_post_meta($post->ID, 'ExternalUrl', true);
$output .= '<a href="https://www.test.com" class="entry-featured-image-url">';
} else{
$output .= '<a href="' . esc_url( get_the_permalink( $post_id ) ) . '" class="entry-featured-image-url">';
}
seoguy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote