Trying to show a button only when a WordPress custom field value is present

On a WordPress site, in a product template, I have a section that shows a custom field value. On the site, the container is hidden by default. A visitor can click a button that slides open the container. The button is just in the template, static.

I am using this to show the value of my custom field:

Read More
if ( function_exists('get_custom_field_value') ){ 
    get_custom_field_value('fieldname', true);  
}

So what I’m trying to do is make it so the button only shows up if there is actually a value in the custom field.

I’m a total PHP newb. Any advice?

Related posts

Leave a Reply

1 comment