Forums

Inserting external url won't work on theme (7 posts)

  1. imeancomeonjoe
    Member
    Posted 2 years ago #

    I'm using this theme called 'Affair' (http://themeforest.net/item/affair/61222). In order to insert images you have to create a custom field and write in "thumb" for name and the url for value. It works fine when the image is uploaded to my wp folder and that url is copied into value but when i want use an external url, it won't work. here is some of the code where i think the problem lies. Any ideas. thanks!

    <?php
    $thumb = get_post_meta($post->ID, 'thumb', true);
    if ($thumb == '')
    { ?>

    "><img src="<?php bloginfo('template_directory'); ?>/images/bigthumb.png" alt="<?php the_title(); ?>" width="430" height="270" />

    <?php } else { ?>

    "><img src="<?php bloginfo('template_directory'); ?>/thumb.php?src=<?php echo get_post_meta($post->ID, "thumb", $single = true); ?>&h=270&w=430&zc=1" alt="<?php the_title(); ?>" width="430" height="270" />

    <?php } ?>

  2. esmi
    Theme Diva & Mod
    Posted 2 years ago #

    when i want use an external url, it won't work

    Where are these images located? Are they your images?

  3. imeancomeonjoe
    Member
    Posted 2 years ago #

    no they're not my images, they'd be from other websites to ie promote their site or product or image.

  4. esmi
    Theme Diva & Mod
    Posted 2 years ago #

    It may seem rather obvious but can you upload these images to your site? Only the code snippet you gave above doesn't lend itself to dealing with external image urls. My guess is that when you try to use an external url, you're getting a blank space, yes?

  5. imeancomeonjoe
    Member
    Posted 2 years ago #

    yes exactly i am getting a blank scree. I know i can upload these images to my wp folder but I'm working with someone who is used to the simplicity of twitter and just copying and pasting the links they see. any ideas how to work around it?

    thanks

  6. esmi
    Theme Diva & Mod
    Posted 2 years ago #

    How about, when adding an external image, writing in "external" for name and the url for value?

    <?php
    $thumb = get_post_meta($post->ID, 'thumb', true);
    $external = get_post_meta($post->ID, 'external', true);
    
    if( $thumb !== '' ) :?>
    "><img src="<?php bloginfo('template_directory'); ?>/thumb.php?src=<?php echo get_post_meta($post->ID, "thumb", $single = true); ?>&h=270&w=430&zc=1" alt="<?php the_title(); ?>" width="430" height="270" />
    
    <?php elseif( $external != '' ) : ?>
    "><img src="<?php echo get_post_meta($post->ID, 'external', $single = true); ?>" alt="<?php the_title(); ?>" width="430" height="270" />
    
    <?php else : ?>
    "><img src="<?php bloginfo('template_directory'); ?>/images/bigthumb.png" alt="<?php the_title(); ?>" width="430" height="270" />
    
    <?php endif; ?>

    Bear in mind that this is off the top of my head and hasn't been tested for syntax errors etc.

  7. imeancomeonjoe
    Member
    Posted 2 years ago #

    It didn't work esmi.. but thank you! We're going to just download the pics and use it as it was set up.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.