WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] What is wrong with this code snippet?? (2 posts)

  1. ThorHammer
    Member
    Posted 4 years ago #

    I use this code in order to get custom field values (image urls):

    <?php
    } ?>
    <?php $withdraws=get_post_meta($post->ID,"tcwithdraws",false); ?>
    
    <?php foreach($tcwithdraws as $withdraw)
    {
    list($width, $height, $type, $attr) = getimagesize($withdraw);
    ?>
    <img src="<?php echo $withdraw;?>" <?php echo $attr; ?> alt="">
    <? } ?>

    The custom key I have created is named "tcwithdraws". The value is image urls. But I get told that I have an un-defined variable?? Could anyone please point it out from this code??

  2. ThorHammer
    Member
    Posted 4 years ago #

    Never mind, I found the error. The first variable missed the "tc" in the start.

Topic Closed

This topic has been closed to new replies.

About this Topic