Support » Fixing WordPress » PHP statement

  • Resolved staceyzav

    (@staceyzav)


    Hi – I’ve created some custom fields (from the “Advanced Custom Field” plugin) and I’m trying to combine some PHP statements (that I have been able to get to work alone) that will look to see if those values have been entered and then based on which ones have been entered it will allow me to return some HTML code. Here is the logic I am after:

    • IF is home – return sidebar named video (the following code works by itself)

    <?php /* Widgetized sidebar */
        if ( is_home() ) dynamic_sidebar('vid'); ?>

    • ELSE: if is NOT home AND “gallery” field has been entered

    echo: <div class=”gallery”><?php the_field(‘gallery’); ?></div>

    • ELSE IF: if is NOT home AND gallery field NOT entered AND video field IS entered
    echo
    <a href="<?php the_field('video_url'); ?><?php the_post_thumbnail(); ?></a>

    • ELSE IF: is NOT home and gallery and video fields NOT entered

    echo
    <?php the_post_thumbnail(); ?>

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘PHP statement’ is closed to new replies.