Support » Plugin: Simple Fields » [Plugin: Simple Fields] Images hide of none selected

  • Resolved 50slespaul


    Wondering if there is a way to hide the field if an image isn’t selected in the admin?

    calling an image like so:

    <?php $imgsrc = wp_get_attachment_image_src($getfields[“Image”][$count], ‘Image’); ?>

    <img src=”/wp/wp-content/themes/mytheme/phpThumb.php?src=<?=$imgsrc[0]?>&w=100&h=100&zc=1″ alt=”<?php echo($getfields[“Name”][$count])?>” title=”<?php echo($getfields[“Name”][$count])?>

    but if a user does not select an image in the admin, I want to have the whole <img> tag gone so there is nothing there… I am gettimg an empty img tag now… anyone?

Viewing 1 replies (of 1 total)
  • Plugin Author Pär Thernström


    Can’y you just check if $imgsrc contains anything?

    if ($imgsrc) {
    // output image…

    or perhaps

    if (isset($imgsrc)) {
    // output image…

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Simple Fields] Images hide of none selected’ is closed to new replies.