• tuckerjoenz

    (@tuckerjoenz)


    I’m looking for a way to add a conditional for a snippet of code in a plugin. I want to check if it is set in the admin and if so show that data, if not show nothing. Here is my code:

    function display_manager_info() {
          // Some functional code
    }

    in my html code I have this right now:

    <?php display_manager_info(); ?>

    So if there is nothing set, right now it has the div and labels showing empty. How in PHP/Wordpress is this done? I’m a newbie. Thanks for you help in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • J M

    (@hiphopinenglish)

    How is manager_info stuff stored? Theme options, post meta? That is how to determine your conditional call.

    For example:

    function display_manager_info() {
          $display_info = get_option( 'has_manager_info' );
          if ($display_info) {
          // do your thing
          } else {
          // bail or do something else
    }
    Thread Starter tuckerjoenz

    (@tuckerjoenz)

    Thanks for getting back to me. It’s stored in theme options. I think I understand you have done here and will give that a try. Thanks!

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

The topic ‘Conditional for custom function’ is closed to new replies.