[resolved] PHP statement (3 posts)

  1. staceyzav
    Posted 3 years ago #

    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
    <a href="<?php the_field('video_url'); ?><?php the_post_thumbnail(); ?></a>

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

    <?php the_post_thumbnail(); ?>

  2. staceyzav
    Posted 3 years ago #

    I ended using page templates, so never mind (moderators, feel free to delete). Thanks anyway!

  3. Andrew Nevins
    Forum moderator
    Posted 3 years ago #

    I think your posts can still benefit the WordPress community, so I'll leave it.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.