How does the featured image work?

Community Forums Forums Design Tips and Tricks How does the featured image work?

This topic is: not resolved

This topic contains 14 replies, has 3 voices, and was last updated by  slydawgg 1 year, 5 months ago.

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #44718

    kathiemt
    Participant
    Post count: 120

    Is there anywhere on this site that gives instruction on how a featured image works please?

    I’ve been bumbling along and have used them sometimes but now that I’m using a theme that I think needs them, there isn’t any instructions that actually explain how they work or why or what I need to do.

    For example, I’m wanting to put three posts on the home page – the instructions for the theme shows ‘tick the featured image’ but doesn’t actually say when you write the post you must insert a featured image.  I’m guessing that is the case.

    I did do a featured image for one post and it’s showing up on the home page with the image, but no image is showing in the post itself when I view the whole post.

    Given that I usually host my images on a separate site and use embed codes instead, I’m wondering how I should be handling things now I am using a different theme?

    If there is an explanation, tutorial, or something somewhere that explains how they work, I would love to be pointed to it. Thank you.


    Virtual Assistant & Nature Photographer
    Kathie Thomas: VADirectoryClick here for Australian images

    http://dandenong-ranges-photography.com.au/
    #44719

    braddalton
    Participant
    Post count: 10563

    Its pretty easy really.

    Most themes display your featured image as a thumbnail on all archive pages like your blog page, author and category archive pages. It will be resized according to your settings.

    You’ll need to add a featured image to all posts using the module on all edit screens.

    The Genesis > Theme Settings > Content Archives enable you to set the size for the featured image thumbnail which is displayed on your archives.

    Your child themes functions.php file includes image sizes which determine the sizes you can select from in the drop down menu for the featured posts widget and content archives.

    Your media settings also include sizes that can be used to determine the size of your featured image on archive pages.

    If you also want to display your featured image above or below your single post titles, you can add extra code to your child theme which does this or insert the image manually in your editor.

    Another option is to create a custom field with meta box if you want a different featured image for single posts than whats displayed on archives.

    Some themes also include code which displays the featured image above the post title so you only need to add it from the module in the edit post screen.

    Need code? Please ask in a new thread.

    Looks like Puffing Billy is still chugging along!


    #44723

    kathiemt
    Participant
    Post count: 120

    The key thing I need to know, though, is how to make an image a featured image if I’m using an embedded code from Flickr. I don’t want to be uploading images to host on my site.

    I remember seeing, at one time, an option to make an image a featured image in the edit window for images. But it’s not there. I’m using WP 3.5.1 so don’t know if it’s been removed, or whether it’s not available because I used embedded code for my images, rather than uploading to my site.

    And yes, it’s still chugging along. Just heard its whistle – the dinner train is out tonight.


    Virtual Assistant & Nature Photographer
    Kathie Thomas: VADirectoryClick here for Australian images

    • This reply was modified 1 year, 5 months ago by  kathiemt.
    • This reply was modified 1 year, 5 months ago by  kathiemt.
    #44728

    braddalton
    Participant
    Post count: 10563

    You can do this using a custom field which is coded to allow the insertion of a external URL for each featured image/post thumbnail.

    Or you can code it so the first image in each post is used as the post thumbnail on archive pages.


    #44729

    kathiemt
    Participant
    Post count: 120

    How do I find out how to do the coding please Brad?  I’ll need to be doing this for every post I do – and that’s usually several times a week. So is it a code in the css or function.php or per post?  The second option is probably the best one, so that the first image for each post is used. Although I guess either will be fine.


    Virtual Assistant & Nature Photographer
    Kathie Thomas: VADirectoryClick here for Australian images

    #44782

    braddalton
    Participant
    Post count: 10563

    Try this

    Code not displaying? Grab it on Github.

    Copy the code from the view raw link and paste it at the end of your child themes functions.php file using a text editor like Notepad++

    On line 4 change this:
    [php]
    if ( is_page() )
    [/php]
    to
    [php]
    if ( is_single() )
    [/php]


    #44839

    kathiemt
    Participant
    Post count: 120

    Thank you for your time Brad. I’ll let you know how I go.

    I checked your sig links and I used to live near you in Cheltenham, till almost 4 years ago. As you might have guessed I’m up near the Puffing Billy now.


    Virtual Assistant & Nature Photographer
    Kathie Thomas: VADirectoryClick here for Australian images

    #44853

    kathiemt
    Participant
    Post count: 120

    Sorry, back again. I have inserted that code into my function.php as directed. And I’ve now added a new blog post with 3 images that are inserted via the url address. However, none are showing up as a thumbnail on the home page and when I go to the featured image portion in Add Media there isn’t anywhere to add a URL for an image.

    Perhaps I’m misunderstanding what is supposed to be happening here Brad?

    http://dandenong-ranges-photography.com.au/


    Virtual Assistant & Nature Photographer
    Kathie Thomas: VADirectoryClick here for Australian images

    #44857

    braddalton
    Participant
    Post count: 10563

    It may not work for images hosted externally.

    You might need a custom field written for this purpose Kathie.

    Its not a simple job and would require me to write the code manually and test it.

    I have spent a fair amount of time searching for this answer and cannot find a solution which exists.


    #44858

    braddalton
    Participant
    Post count: 10563

    Another option is to use a premium plugin like this http://epicplugins.com/external-url-link-to-featured-images/

    I haven’t tested this so i don’t know if it will solve your problem.


    #44859

    kathiemt
    Participant
    Post count: 120

    Yes, I did put it as instructed. Thank you, I appreciate you researching it. I have been too. I was also told about a Flickr plugin that might work but that produced an error code when activating it. I guess I’ll have to do the manual thing and upload for a featured image – a smaller version so that I’m not adding too much to the hosted space. Thanks for your efforts, I do appreciate them.

    If WordPress still had the function for making the image a feature in the window when I view the image it might have worked, but it no longer appears to be there.


    Virtual Assistant & Nature Photographer
    Kathie Thomas: VADirectoryClick here for Australian images

    #45323

    slydawgg
    Participant
    Post count: 20

    Brad, your code example came close to what I was trying to do; but not 100%. Hopefully you can assist:

    > On a Category Posts Page = just show small thumbnail of the featured image (this seemed to work just fine by using a Page, set to Blog, and adding the Custom Field of query_arg = 7 (or whatever my category id was)

    > On Single Posts = need to show the full sized image of the featured image

    =======
    So imagine this =

    Category page     = images are 150x150 and 1 per post
    Posts single page = images are 500x450

    =======
    Currently I have a Page with Blog template & query_id Custom field & it displays little sized thumbnails just fine, also
    If I go to the /category/whateverCat link I see thumbnails as well, but when I go to the Posts single page – no image displays.

    If I add your code above, and change to is_single I then see large images for each Posts on the Category page, but still not on the Post Single page…  Any ideas?

    Should I open a new thread?

    Also, I can’t include the URL publicly yet, but if you need me to email you the URL privately I can do so.

     

    #45326

    braddalton
    Participant
    Post count: 10563

    Yes open a new thread please but you have the right idea.

    Simply replace the conditional tag for is_page to is_single which you can actually see I have already noted under the snippet.


    #45332

    slydawgg
    Participant
    Post count: 20

    Thanks Brad, and I did see that before, which I thought I explained in my previous message.  So the code I have in place in functions.php is

    add_action( 'genesis_before_post', 'wpsites_before_post_image', 5 );
    function wpsites_before_post_image() {
    
    if ( is_single() ) return;
    
    if ( $image = genesis_get_image( 'format=url&size=post-image' ) ) {
    printf( '<a href="%s" rel="bookmark"><img class="post-photo" src="%s" alt="%s" /></a>', get_permalink(), $image, the_title_attribute( 'echo=0' ) );
    }
    }

    Unfortunately, for reasons I can’t figure out, is the Category page is showing the large images above each Posts on the Category page; while the Single Post page doesn’t even show the featured image.

    Also, I did just try this for testing, without any change:

    add_action( 'genesis_before_post', 'agency_post_image' );
    function agency_post_image() {
    if ( is_single() ) return;
    if ( $image = genesis_get_image( 'format=url&size=post-image' ) ) {
    printf( '<a href="%s" rel="bookmark"><img class="post-photo" src="%s" alt="%s" /></a>', get_permalink(), $image, the_title_attribute( 'echo=0' ) );
    }
    }

    Am I missing something still?

    Thanks for your patience

    #45346

    slydawgg
    Participant
    Post count: 20

    Ah, I figured it out Brad.

     

    I have figured out what I was trying to do.  Looks like the following:

    add_action( 'genesis_before_post', 'agency_post_image' );
    function agency_post_image() {
    
    if ( is_category() ) return;
    if ( $image = genesis_get_image( 'format=url&size=post-image' ) ) {
    printf( '<a href="%s" rel="bookmark"><img class="post-photo" src="%s" alt="%s" /></a>', get_permalink(), $image, the_title_attribute( 'echo=0' ) );
    }
    }

    That way, it doesn’t display on the Category pages, but does display on all other types of Single Posts and Pages.

    Thanks for getting me on the right track!

Viewing 15 posts - 1 through 15 (of 15 total)

You must be logged in to reply to this topic.