Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Patrick

    (@randomgift)

    Would this work?

    <?php
    if (function_exists('plugin_options')) {
        <img src="<?php echo $options['logo']; ?>" alt="Logo" />
    } else {
        <a href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a>
    }
    ?>

    I’m pretty new at this so I’d love some advice

    Chip Bennett

    (@chipbennett)

    You’re querying for an option, not for a function.

    Try this instead:

    <?php
    $options = get_option('plugin_options');
    if ( $options['logo'] ) { ?>
         <img src="<?php echo $options['logo']; ?>" alt="Logo" />
    <?php } else { ?>
         a href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a>
    <?php }
    ?>

    Thread Starter Patrick

    (@randomgift)

    Fantastic! That worked like a charm, thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Not sure how to use if function exists’ is closed to new replies.