From here It’s from 2010 so I’m wondering what am I missing and what should I add (whats mandatory)
Did you review the page I linked to above?
Yes, thanks for the link.
So i need to add a peace of code to functions.php and then
add the php/html code where i want featured post to show up ? 🙂
There was a lot of code on the page, but I guess I add this code to functions.php
<?php the_post_thumbnail( $size, $attr ); ?>
Correct me if I’m wrong
add_theme_support( 'post-thumbnails' );
this is what you need to include in your function.php to enable post-thumbails
, and go through the esmi’s link for more info on how to retrieve and show the thumbnails.
What @LastForOne said. 🙂 Personally, I’d just start with off with using <?php the_post_thumbnail(); ?>
in your theme’s template files and see how that goes.
Alright thanks, did it.
Now if I want my featured image to be linked to a post in which it was placed where do I add this:
add_filter( 'post_thumbnail_html', 'my_post_image_html', 10, 3 );
function my_post_image_html( $html, $post_id, $post_image_id ) {
$html = '<a href="' . get_permalink( $post_id ) . '" title="' . esc_attr( get_post_field( 'post_title', $post_id ) ) . '">' . $html . '</a>';
return $html;
}
[Please post code snippets between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]
Thanks once more
After I added
add_theme_support( ‘post-thumbnails’ ); i have the option for Featured image. Also added background image option in Functions and it works also
What exactly are you trying to do? What kind of page are you trying to create?
For example
http://worldoftanks.com/
Look at the middle of site section: News
There is the image in the left corner (Featured image in our wordpress) and title on the right side.
The image links to the post/title. Thats what i want to have enabled and i thought the code above would get me to that to work
So this is for your site’s main posts page, yes?
Yes, but I want to use featured also on single.php. I guess the core code will be the same for it to be able to show up
[No bumping – especially after less than 1 hour! If it’s that urgent, consider hiring someone.]