Forums

urgent... whats wrong with this code, image wont show (7 posts)

  1. veranopage
    Member
    Posted 1 year ago #

    <?php $feature = get_post_meta($post->ID,'feature', true); ?>
    <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" > <img src="<?php echo ($feature); ?>" width="250" height="250" alt="<?php the_title(); ?>"/> </a>

    any ideas?

  2. Digital Raindrops
    Member
    Posted 1 year ago #

    You do not need the brackets here!

    <img src="<?php echo ($feature); ?>"

    So

    <img src="<?php echo $feature; ?>"

    Also there is not test to see if the custom field is populated, or the image exists.

    <?php $feature = get_post_meta($post->ID,'feature', true); ?>
    <?php if($feature) : ?>
       <?php if( file_exists( $feature) ) : ?>
    
       <?php endif; ?>
    <?php endif; ?>

    HTH

    David

  3. lavel
    Member
    Posted 1 year ago #

    I'm also getting that but mines says <img src="
    <b>fatal error</b> call to undefined function logo...
    something like that. What's up with it?

  4. Digital Raindrops
    Member
    Posted 1 year ago #

    Hi lavel,
    I see you already have a topic open for your issue, please do not hijack another users topic!

    It is early and your post is just an hour old posted 8am UK, 3am USA, you may get answers when the web wakes up, or not if the readers are not familiar with the issue, or there is not enough informtion in your topic.

    Please do not reply on this topic!

    Cheers

  5. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    @veranopage

    what is the content of that custom field?

    it should be the absolute image url (example: http://siteurl/folder/image.jpg)

    what html code is output by your code if you check that section in the browser?

  6. lavel
    Member
    Posted 1 year ago #

    What do you mean hi-jack. I'm new to this forum--I haven't checked for any rules that says you can't reply here because you got something here. I didn't know that. That word is very forcible. I don't like that? Thanks.

  7. Digital Raindrops
    Member
    Posted 1 year ago #

    Hi Lavel,
    Sorry you may have been offended, as you are new to the forums please read the following topic, as bumping and posting on another topic are not good order!
    http://codex.wordpress.org/Forum_Welcome

    Note this section in Forum Welcome topic, as you had already posted your topic just before posting here, and this topic is about custom fields and yours is about missing functions, I posted the comment above.

    These issues are not 100% the same, I did take the time out to look at your post and reply:

    Where To Post

    The forum is split into sections, with each forum having its own one-line description on the front page.

    Please try to choose the most suitable section for your new topic, and please post your topic in only one section.

    Multi posting is frowned upon. Posting your own topic is smiled upon.

    Unless you're having 100% without any doubts or variation, the exact same problem, do not post in someone else's thread. Make your own.

    HTH

    Peace

    David

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.