• I’m using a nifty plug-in called List Yo Files to show a linked list of downloadable files in a sidebar.

    The plugin has some nice options but the one it’s lacking is to put a heading above your list. So, I’m trying to determine how to do this where it’s called into the template so that it will only show if there is a list displayed.

    It’s called in by getting a custom field added to the User profile admin where the List Yo Files short code is inserted:

    <?php
    $content = $curauth->extra3;
    echo do_shortcode($content);
    ?>
    Is there any way for me to echo a title like “Articles & Publications” only if there are files?

    Clearly I can add echo ‘<h3>Articles & Pubs</h3>’; and it will display. But it will display even if the list is empty. Not being PHP savvy, I don’t really know how to make that happen.

Viewing 1 replies (of 1 total)
  • How about:

    <?php
    if( $curauth->extra3 ) :?>
    <h3>Articles & Pubs</h3>
    <?php $content = $curauth->extra3;
    echo do_shortcode($content);
    endif;?>
Viewing 1 replies (of 1 total)

The topic ‘If statement to show heading?’ is closed to new replies.