Community Forums › Forums › Archived Forums › Design Tips and Tricks › How does the featured image work?
- This topic has 14 replies, 3 voices, and was last updated 10 years, 10 months ago by slydawgg.
-
AuthorPosts
-
June 8, 2013 at 12:51 am #44718kathiemtParticipant
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.
Kathie Thomas
June 8, 2013 at 1:14 am #44719Brad DaltonParticipantIts 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!
June 8, 2013 at 3:36 am #44723kathiemtParticipantThe 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.
Kathie Thomas
June 8, 2013 at 5:18 am #44728Brad DaltonParticipantYou 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.
June 8, 2013 at 6:49 am #44729kathiemtParticipantHow 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.
Kathie Thomas
June 8, 2013 at 11:42 am #44782Brad DaltonParticipantTry 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:
if ( is_page() )
to
if ( is_single() )
June 8, 2013 at 7:08 pm #44839kathiemtParticipantThank 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.
Kathie Thomas
June 8, 2013 at 10:18 pm #44853kathiemtParticipantSorry, 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/
Kathie Thomas
June 8, 2013 at 11:49 pm #44857Brad DaltonParticipantIt 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.
June 9, 2013 at 12:09 am #44858Brad DaltonParticipantAnother 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.
June 9, 2013 at 12:29 am #44859kathiemtParticipantYes, 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.
Kathie Thomas
June 11, 2013 at 12:16 pm #45323slydawggMemberBrad, 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.
June 11, 2013 at 12:38 pm #45326Brad DaltonParticipantYes 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.
June 11, 2013 at 1:03 pm #45332slydawggMemberThanks 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
June 11, 2013 at 2:17 pm #45346slydawggMemberAh, 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!
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.