Skip to main content
update
Source Link
tfrommen
  • 9.2k
  • 7
  • 39
  • 59

I think, you're mistaken in how if works...?

global$post_meta $wp_query;= get_post_meta(
$postid = $wp_query  $GLOBALS['wp_query']->post->ID;>ID,
if ( ! empty( get_post_meta($postid, 'TourURL',
    true 
);
if )(! empty($post_meta)) echo '<P>Show'<p>Show Link</P>';p>';
else echo '<P>No'<p>No Link</P>';
wp_reset_query();p>';

This should do what you want - if I understood you correctly.

// EditUPDATED

If you want to work with the meta data, you might want to use a variable to store the data, then check if this variable is empty.

I think, you're mistaken in how if works...?

global $wp_query;
$postid = $wp_query->post->ID;
if ( ! empty( get_post_meta($postid, 'TourURL', true) ) ) echo '<P>Show Link</P>';
else echo '<P>No Link</P>';
wp_reset_query();

This should do what you want - if I understood you correctly.

// Edit

If you want to work with the meta data, you might want to use a variable to store the data, then check if this variable is empty.

I think, you're mistaken in how if works...?

$post_meta = get_post_meta(
    $GLOBALS['wp_query']->post->ID,
    'TourURL',
    true 
);
if (! empty($post_meta)) echo '<p>Show Link</p>';
else echo '<p>No Link</p>';

This should do what you want - if I understood you correctly.

// UPDATED

Source Link
tfrommen
  • 9.2k
  • 7
  • 39
  • 59

I think, you're mistaken in how if works...?

global $wp_query;
$postid = $wp_query->post->ID;
if ( ! empty( get_post_meta($postid, 'TourURL', true) ) ) echo '<P>Show Link</P>';
else echo '<P>No Link</P>';
wp_reset_query();

This should do what you want - if I understood you correctly.

// Edit

If you want to work with the meta data, you might want to use a variable to store the data, then check if this variable is empty.