First, if meta key is isbn_metadata
is the meta_key
you should specify this meta key instead of _isbn
.
Second, get_post_meta
return an array unless you set the third parameter to true. So, you can do this:
function get_kalahari_affiliate_link() {
$isbn_metadata = get_post_meta( get_the_ID(), 'isbn_metadata', true );
if( ! empty( $isbn_metadata ) ) {
$link = 'http://etrader.kalahari.net/referral.asp?linkid=5&partnerid=5710&ISBN=' . $isbn_metadata;
} else {
//Empty string or you can set any other value for control
$link = '';
}
return $link;
}
Note: You are using get_the_ID()
, I assume you are executing the function inside the loop as required by get_the_ID()
.
About the widget areas problem, as you are using a third party software, you should ask to the developer.
Related Posts:
- How do I replace a function, declared inside a plugin’s class, in functions.php?
- Shared functionality in plugins and themes
- Prevent publishing the post before setting a featured image?
- How to Loop Plugin Option Field Set?
- Can we completely remove the WordPress Sitemaps (WordPress 5.5)?
- Why does including a file in theme’s functions.php not work?
- How to load plugin before the wordpress jquery?
- Disabling post images for not logged in users
- WordPress ajax call for not logged in users, doesn’t work
- Extend Elementor Archive Posts widget with a custom skin in order to show multiple badges
- HELP: Integrating WP with raw PHP code once published button is hit
- How to redirect Old Post URL to new Post and keep Old post Comments?
- Modifying Footnote Plugin for Descriptive Title Attributes
- I would like to use create a function in my custom plugin to tell WP to use a different header
- bulk change of image setting “link to” to “link to: image url “
- Limit the number of plugins that can be installed in a WordPress installation
- Add get_option to jquery
- How to get variables from fucntion.php to my plugin files
- Avoiding Duplicate function names in Post Loop (WP_Footer script)
- How to add class in plugin only for network site?
- Executing my function once on a specific time
- How to stop or remove an action being called inside a function of an extended class
- Date calculations from 2 custom fields
- Does WordPress validate inputs to all functions? (such as get_user_meta and insert_user_meta)
- Using a function to change favorites listing
- How to debug error message: Cannot modify header information
- How to enable specific plugin only based around shop manager role?
- Adding a new field to the address field type in gravity forms
- Nested shortcode functions accessing variable
- Calling an attribute from a plugin shortcode
- Difference and examples of esc_attr__() and esc_attr_e()
- Redirect to another page using contact form 7? [closed]
- Display Custom Field Value on Admin Page Column
- List the authors that have written posts in a category
- How to get plugin name from plugin file location
- How to prevent additional code in functions.php to be removed once there is an update?
- Checking the count within a foreach loop
- Create a post builder skin in a plugin
- Need to replace Currency Shortforms
- add_query_arg not work in admin
- Woocommerce singe product custom gallery output works just on the first slide
- How do I create a custom permalink structure for a page template
- How to remove a class function from a plugin by using remove_action()?
- How to translate wordpress error message
- Api external with wordpress
- strange shortcode error: does shortcodes requires any dependency?
- All custom widgets are not showing in widget area at the same time
- Hook for altering the content of all wp mails
- How to get rid of Ellipsis on Woocommerce [Essential] Theme [closed]
- Sharing functions between plugins
- Execute a function when the entire page is displayed
- More gentle way to hook WordPress custom url
- How to add custom function to pluggable.php
- Removing the custom_image_header from wp_head
- auto activate plugin when theme is active
- Build a must-use plugin that tracks when other plugins are activated or deactivated
- Checkbox show / hide output result
- How to keep plugin (media-sync) running even the tab is closed?
- Load CSS before Theme CSS
- Custom Logo Link WordPress
- Where do I put the code snippets I found here or somewhere else on the web?
- How to convert Currency from USD to other IP Based currency in Php function
- Attempting to list all product categories and the price range of all products within them
- the_posts_pagination() not working if I add wp_head() to header.php
- FPDF for creating pdf diplomas
- Creating an array from form inputs before it is posted to the options database
- function post to trash problem
- adding dynamic/multiple slug values in ‘option_none_value’
- How to assign a specific service to a specific provider based on location
- Conditional Homepage for logged in user
- Is admin section completely customizable in terms of styling?
- Compare Ajax Data Results
- EventON – Dequeue Styles
- How can I make the search bar in my wordpress site search all of the pages rather than just the blog posts?
- Migrating custom php we wrote from functions.php into a site-specific plugin
- Nested DIV’s across functions in PHP, do not seem to work
- WordPress Add advertising ads befor and after content with periority [closed]
- Function in my plugin is called twice
- Searched & tried a lot: Is it Possible to Eliminate Render Blocking Manually
- Every time I use wp_get_current_user() my plugin breaks
- Can plugin automatically update if i hide the update notification?
- Conditional required fields for WordPress Contact Form 7
- AJAX login without a plugin does not work. when add a action to function.php
- Cannot access variables within a widget
- Saving plugin data returns “You do not have sufficient permissions to access this page.”
- How to use scripts when header/footer are stripped out
- How to add a handler for a button in plugin?
- Custom Function for SEO by Yoast plugin
- Call current post parameters inside a plugin
- How to list posts that appear in two categories
- Building custom pages with a video player
- Move related products after product summary? [closed]
- Adminimize Plugin — Is there an alternative to limiting Editor to ‘Appearance > Widgets’ only?
- Woocommerce – Product Description heading [closed]
- Woocommerce disable checkout on specific day
- Sync roles across several plugins
- Gravity Forms and Gravity View Permissions
- Run a function only once when logging into dashboard
- Event Made Easy – Block registration to two or more events that have the same category
- I want to allow certain file types on dokan upload files