• hitmanuk2k

    (@hitmanuk2k)


    I have no idea about coding and such.

    Does anyone have any idea how you could go about having a custom field on a wordpress post, that you can put an image url – which you can then call using something like $customfield next to something like the ‘Recent Posts’ (so I have an image next to the title for the post).

    Well, thats not the exact usage I plan, but easier than explaining in full ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • styledsheet

    (@styledsheet)

    add a file called functions.php to your template.

    in it, write:

    <?php
    function custom_image(){
    	echo '<img src="the location of your image" alt="" />';
    	}
    ?>

    Then, everytime hyou want to insert the image somewhere, write this: <?php custom_image() ?>

    Is this what you’re looking for?

    I’m curious about being able to do this as well. I think what we’re talking about a custom field you could enter in a post that would be the path to a thumbnail image, and then the ability to use that field.

    I’d like to be able to code a loop where I call the headline, the excerpt, and the thumbnail image… But I’d like the thumbnail to be its own field…

    the Post-Image plugin?

    Because of table changes in WP 2.1.x I don’t think that plugin works with 2.1.2. The OP didn’t say what version of WP they were using so maybe it’s the ticket ??

    ianternet

    (@ianternet)

    I am having some issues with the custom field too pulling images on a per category basis, it works as a standard loop but not on a per category

    this is what I have:

    <?php get_header();
    $tabber_image = get_post_meta($post->ID, ‘Tabber Image’, $single = true);

    ?>

    This is what I have to where I want the image to show – but it will show the same image to all categories I want each individual category to show it’s unique image.

    <?php if($tabber_image !== ”) { ?>

    ” rel=”bookmark”>
    <img src=”<?php echo $tabber_image; ?>” alt=”<?php echo get_post_meta($post->ID, “Theme Name”, true); ?> Thumbnail” border=”0″/>

    <?php } // end if statement

    // IF THERE IS NO IMAGE
    else { echo ‘<img src=”DEFAULT IMAGE SOURCE” />’; } ?>

    Thanks any advice is helpful

    ianternet

    (@ianternet)

    the link shouldn’t be there – for some reason it just auto the link

    <?php if($tabber_image !== '') { ?>
    
    	<a h*ref="<? echo the_permalink(); ?>" rel="bookmark">
    	<img src="<?php echo $tabber_image; ?>" alt="<?php echo get_post_meta($post->ID, "Theme Name", true); ?> Thumbnail" border="0"/></a>
    
    <?php } // end if statement
    
    // IF THERE IS NO IMAGE
    else { echo '<img src="https://i41.photobucket.com/albums/e263/ifernando/mini%20pics/moneypile.jpg" />'; } ?>
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Custom Field Image?’ is closed to new replies.