PHP - Moved: Php If Statement Help (wordpress)
This topic has been moved to PHP Applications.
http://www.phpfreaks.com/forums/index.php?topic=358684.0 Similar TutorialsThis topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=318784.0 Hi all, I've been struggling to get an if statement to work. I'm new to PHP so bear with me! I have an events listing page where I pull a value from a custom field to display a 'buy tickets' button. I can get the button to display and it works well but what I need to do is customise the code so if there is no ID present, then a piece of text displays. Any pointers appreciated. This is one method Im using for custom fields which works well - the if statement works here also. Code: [Select] <div> <p><strong>Location:</strong> <?php $event_location = get_post_meta($post->ID, 'Event_Location', true); if ($event_location) { ?> <?php echo $event_location; ?> <?php } else { ?> <p>No Location Available.</p> <?php } ?> </p> </div> This code pulls in the buy tickets button but I cant figure out how to create an if statement with it! grrrr... Code: [Select] <div> <p> <?php $values = get_post_custom_values('Product_ID'); echo get_button_code_for_product($values[0]); ?> </p> </div> I would like it to look for the ID and if it can't find it then displays ' No Product ID' or some such text. This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=310048.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=314808.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=334215.0 This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=327275.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=311671.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=314030.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=334084.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=358438.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=350210.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=353224.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=322006.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=333014.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=351799.0 This topic has been moved to CSS Help. http://www.phpfreaks.com/forums/index.php?topic=347669.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=348006.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=345134.0 This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=347443.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=343992.0 |