No default photo in post still not working.

Discussion in 'ClassiCraft WordPress Theme' started by themotorcycledude, Aug 11, 2013.

Thread Status:
Not open for further replies.
  1. themotorcycledude

    themotorcycledude Member

    Joined:
    Jul 11, 2013
    Messages:
    83
    Likes Received:
    0
    I found a bug in the following code that you responded to a previous post with. Just in case anyone else needs default image functionality, here is the corrected code:

    <?php
    $count = 0;
    $cc_custom_meta = cc_get_custom_field();
    foreach ($cc_custom_meta as $field) {
    if ($field['type'] == 'image_uploader' && get_post_meta($post->ID, $field['htmlvar_name'], true) != '') {
    $flag = true;
    ?>
    <li> <img src="<?php echo get_post_meta($post->ID, $field['htmlvar_name'], true); ?>" /> </li>
    <?php
    }elseif($field['type'] == 'image_uploader' && get_post_meta($post->ID, $field['htmlvar_name'], true) == ''){
    if($count == 0){
    $default_img = get_template_directory_uri().'/images/temp/sample1.png';
    print "<li><img src='".$default_img."'/></li>";
    }
    ?>
    <?php
    }
    $count++;
    }
    ?>
     
Thread Status:
Not open for further replies.

Share This Page