SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru
    Join Date
    Oct 2010
    Location
    Portland, Or
    Posts
    795
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    trying to add a image w/custom fields.

    following some advice & instructions this is what I am using.
    in functions.php

    Code:
    get_post_meta($post_id, $key, $single);
    in the subtemplate
    Code:
    <?php $image = get_post_meta($post->ID, 'Image', true); ?>
    <img src="<?php echo $image; ?>" alt="image" />
    in the page itself
    customFieldImg01.jpg

    not working? this is a page should the parameters be changed? I checked the codex & got the impression that $post should work as well.
    How could I solve this please?
    thx
    D

  2. #2
    Barefoot on the Moon! silver trophy Force Flow's Avatar
    Join Date
    Jul 2003
    Location
    Northeastern USA
    Posts
    4,617
    Mentioned
    56 Post(s)
    Tagged
    1 Thread(s)
    I'm pretty sure capitalization matters.

    Your screenshot shows "image" as the key, but your code shows "Image".
    Visit The Blog | Follow On Twitter
    301tool 1.1.5 - URL redirector & shortener (PHP/MySQL)
    Can be hosted on and utilize your own domain

  3. #3
    SitePoint Guru
    Join Date
    Oct 2010
    Location
    Portland, Or
    Posts
    795
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Awesome! Thank you, that was right, it fixed the problem.
    Any chance you could take a look at this one http://cdiwwwtest.cdicorp.com/cs & tell me why the thumbnails are not kicking in Please?
    I got it working here
    http://cdiwwwtest.cdicorp.com/engineering

    the code for invoking them is the same
    Code:
    <div class="span4">
    <?php the_post_thumbnail( 'category-thumb' ); ?>
    <a class="readMore" href="<?php the_permalink(); ?>">read more</a>
    </div>
    I think I missed a step early on but can't figure out what? Even tried to add them by the add media feature in the post.

  4. #4
    Barefoot on the Moon! silver trophy Force Flow's Avatar
    Join Date
    Jul 2003
    Location
    Northeastern USA
    Posts
    4,617
    Mentioned
    56 Post(s)
    Tagged
    1 Thread(s)
    I don't see anything obvious in what you provided.

    Check the codex page on post thumbnails to make sure you're doing everything that is recommended: https://codex.wordpress.org/Post_Thumbnails
    Visit The Blog | Follow On Twitter
    301tool 1.1.5 - URL redirector & shortener (PHP/MySQL)
    Can be hosted on and utilize your own domain


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •