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">';
}
|