Results 1 to 6 of 6

Thread: How to add an image using custom fields?

  1. #1
    Thread Starter
    Junior Member ontavu's Avatar
    Join Date
    Dec 2010
    Location
    Casablanca
    Posts
    40
    Thanks
    9
    Thanked 4 Times in 4 Posts

    How to add an image using custom fields?

    Hi,

    I'm trying to add an image with link to external website.
    i use this code:

    PHP Code:
    <?php if( get_post_meta($post->ID"img"true) ): ?>
    <p><a href="<?php echo get_post_meta($post->ID"imglink"true); ?>"><img src="<?php echo get_post_meta($post->ID"img"true); ?>"></a></p>
    <?php endif; ?>
    Using img to add link to image
    and imglink to add link to external website.

    I add this code to single.php

    P.S: i tried this code proposed by mr_green but no result.
    PHP Code:
    <?php $my_custom_fieldbutton get_post_meta($post->ID'YOUR-CUSTOM-FIELD'true);?>
    <?php 
    if($my_custom_fieldbutton !== '') {
    ?>
    <a href="<?php echo "$my_custom_fieldbutton";?>" title="<?php if (strlen(get_the_title()) >= 45) echo substr(get_the_title(), 045).'...'; else the_title(); ?>"><img src="http://YOUR PATH.png" border="0" alt="XXXXXX"></a>
    <?php
    }
    else
    {
    }
    ?>

    But no way wont display.
    Any idea?
    Thanks

  2. #2
    Thread Starter
    Junior Member ontavu's Avatar
    Join Date
    Dec 2010
    Location
    Casablanca
    Posts
    40
    Thanks
    9
    Thanked 4 Times in 4 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  3. #3
    jomarkosabel's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    40,702
    Thanks
    166
    Thanked 3,390 Times in 3,261 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    Please help our moderating team work more efficiently by not sending us support questions via PM. You can read more about how AppThemes support works here. However, you can send a PM to follow up and remind me if I missed your support request/thread.

    Thank you and have a nice day.

  4. #4
    Member barry's Avatar
    Join Date
    Jul 2010
    Location
    South Africa
    Posts
    99
    Thanks
    40
    Thanked 3 Times in 3 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  5. #5
    rubencio's Avatar
    Join Date
    May 2010
    Location
    Spain
    Posts
    3,804
    Thanks
    268
    Thanked 316 Times in 278 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

    r u b e n c i o . c o m


    Since 2010 providing AppThemes solutions,
    Plugins and the best childthemes...



  6. #6
    Junior Member speedy222's Avatar
    Join Date
    Jan 2012
    Location
    Netherlands
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Custom Fields in Custom Forms are not working...
    By alexuz0751 in forum Report ClassiPress Bugs
    Replies: 4
    Last Post: December 31st, 2010, 04:15 PM
  2. New fields similar to image fields where a file can be downloaded
    By acplatt in forum ClassiPress General Discussion
    Replies: 1
    Last Post: July 9th, 2010, 07:01 PM