Last active
June 16, 2016 02:06
-
-
Save sbruner/982978408f047a1443a16d6757527683 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
piklist('field', array( | |
type' => 'url' // HTML5 url field | |
,'field' => 'my_url' | |
,'template' => 'field' | |
,'attributes' => array( | |
'class' => 'regular-text' | |
) | |
)); | |
$my_url = get_post_meta($post->ID, 'my_url', true); // Get the value of the field above | |
piklist('field', array( | |
type' => 'html' | |
,'template' => 'field' | |
,'value' => !empty($my_url) ? '<a href="' . get_post_meta($post->ID, 'my_url', true) . '">Go Url</a>' : '' // if a url has been entered, show it. If not, show nothing. | |
)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment