View Single Post
Old 04-13-2020, 03:32 AM  
seoguy
Confirmed User
 
Join Date: Nov 2004
Posts: 381
Can somebody help me with one line of PHP (wordpress)?

I have a template where the following code creates the link for the featured image:

$output .= '<a href="' . esc_url( get_the_permalink( $post_id ) ) . '" class="entry-featured-image-url">';

now I need it changed, so that it links to an url specified in the custom field "ExternalUrl" with target blank and if there is no Url in that field, it links normaly (like it is now) to the permalink page (without target blank). I did stuff like this before in other templates but I am not good with PHP and having it in this format ($output .= ...) causes trouble for me..
seoguy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote