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
Related Posts:
- Force Sidebar on Full Width page
- Where does php code to load data go?
- ACF – Can’t get custom post type by taxonomy
- What is the correct way to search 3 custom fields only in WordPress?
- wp_get_nav_menu_items() with ACF
- Save custom field on WP_List_Table
- Sum All the Post Meta of Published posts of Current Logged in user
- How do I get the value of a current user’s custom field?
- Trying to retrieve meta values from three different meta keys and display in rows
- Display child-page links in sidebar on both Parent Pages AND Child Pages
- WP post meta – for loop inside for loop
- custom fields anchor points php
- Store custom field’s multiple values in one user meta key
- Get field in readable word
- WooCommerce multiple custom fields code
- Blog Image and Title in Right Sidebar
- When working with a post, almost all wp_postmeta are deleted
- What syntax is this? “{{post.price}}”
- Updating Lat and Lng of posts automatically gives sporadic results
- How to display custom field from a gallery thumbnail?
- WP_query meta_query slow with OR and DATES
- Get meta_query value by user meta array
- How to use something like meta_query but for fields?
- Getting a value from a custom field from a page that shares a parent with the current page
- What image is this pulling?
- meta field for numerous links
- How can the searchform.php know if it’s used on a registered sidebar id ‘sidebar-1’ or ‘sidebar-2’?
- How to list categories by page id in wordpress
- Custom fields changes the formatting of metabox input
- Include a custom field in mysql query
- Adding a sidebar to wp-login.php
- Display Content Based on Custom Field Value
- php if, else & custom fields – syntax error
- How to get the first letter from custom field?
- Meta box not saving spaces
- how to run a php code in widget?
- divide custom field values in div every two values
- custom field meta-box with dropdown/autocomplete
- Showing custom field contents without listing description
- How to exclude post from being queried based on custom meta value
- if conditional in sidebar plugin Password content shortcode
- If custom field doesn’t exist, or exists and it’s true show title?
- How to link a word comprised of a custom field with another?
- Custom field in title
- If Elseif Query
- How can I put a custom field as the link of a button shortcode?
- My custom widget won’t stay in the widget area after I refresh the widget page
- Outputting a custom field in PHP
- Sorting Meta Fields?
- Custom fields randomly stop working
- Display selected parts from selected pages on the frontpage?
- how to remove sidebar from particular one page
- Listing current pages subp page in list items in the sidebar
- Where can I find the code for the menu page meta boxes?
- How to echo a different field if another field is empty?
- How to display different widgets on specific pages, hide from other pages
- Sidebar doesnt get updated?
- How to use custom fields to replace top-level parent title with an image using wp_list_pages?
- PHP Puzzle: Unique Styles with PHP loop
- I want Page titles and excerpts to show up on home.php in certain order
- Posts sortable column not sorting properly for custom field numbers
- Search result page – display values from the result’s metaboxes
- Display custom meta box in my template file
- Query posts by custom fields (object post)
- ACF Date fileds to Age Convert [closed]
- Save custom field value to variable for conditional – why is this not working? [closed]
- Metadata on the WP_Post object
- Appending an ACF custom field to the page title
- Too many if’s and else if’s ?? – Must be better way [closed]
- Advanced Custom Fields Show PHP in Text Areas
- WP query with variables gives no result for specific user
- Grabbing value of input field inside of array
- Displaying custom meta box value in a custom post page
- How to initialise WP_Query on the basis of a specific meta_value and continue iterating rest?
- Convert custom field date format to “WordPress default”
- I want to show image from custom field image on my custom page template
- How can I change the location where the custom field is displayed in the Quick Edit tab in WordPress
- How do I organize posts based on their taxonomy?
- How do you create a front end form that enables the editing of member-specific custom fields in WordPress?
- Search custom post type posts only by meta fields?
- How to pass value to add_filter wpcf7_form_tag from another function?
- Custom Admin Menu Report for Specific User ID
- Need Help With Making Full-Width Template for Blog Posts (common methods aren’t working)
- Shortcode Displays 2 times
- How to execute a shortcode within a custom field?
- Sidebars panel in customizer
- ACF number less than comparison not working
- fetch from an external api call and display results in page
- Problem with custom user fields default value and retrieval
- Cannot Access ACF Field Values via my Plugin
- wordpress-plugin (widget) that performs a Neaby-search on the openstreetmap-endpoint: around x find y
- How to create advanced custom fields for backend content
- ACF block gutenberg aligncenter don’t work
- How to pull through page title depending on which radio button is selected on the specific page?
- Display WooCommerce Order Custom Field In Template (HPOS)
- How can I display a layout differently depending on whether the user is on Mobile or PC?
- hide “Open in New Tab” checkbox in link field
- Side bar only if it’s not a single post or a specific page
- Want to add custom post type for facebook feed
- Exclude function for custom pages, exclude custom ACF fields