• Resolved artfulalibi

    (@artfulalibi)


    Hello. I apologize ahead of time, my PHP is only basic.

    I am using some custom field data to pass a variable to a function in my theme template. However, when I don’t use the custom field, it causes an error in the function because it has no data. Is there any way for me to write an if statement based on the custom field data, kind like of if function_exists?

    Here is my code:

    <?php
    	setZoom(3);
            setWidth(400);
            setHeight(350);
    	addAddress(get_meta('building_address'));
    	showMap();
    	?>

    Basically I want something that says if the key ‘building_address’ has data in it, run this function.

    Thanks everyone!

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Function using Custom Field content’ is closed to new replies.