Add class name to post thumbnail

I’m using post thumbnails to link to a page. Is it possible to add a class name to the post thumbnail image. <li><a href=”https://wordpress.stackexchange.com/questions/102158/<?php the_permalink(); ?>” ><?php the_post_thumbnail(); ?></a></li> 4 Yep – you can pass the class you want to use to the_post_thumbnail() as part of the attributes argument, for example <?php the_post_thumbnail(‘thumbnail’, array(‘class’ => … Read more

How to get image title/alt attribute?

In my white theme, there is no alt attribute configured for the home slider post. I added the alt text for the image through the media library interface. I added the following code to display the alt text/attribute. But it does not display: <img class=”homepage-slider_image” src=”http://www.blabla.com/wp-content/uploads/2013/06/cms-website4-1800×800.jpg” alt=”” /> Here is the code: <?php $image = … Read more

How do I get image url only on the_post_thumbnail

I want to know how to get image url on the_post_thumbnail() Default the_post_thumbnail() <img width=”800″ height=”533″ src=”http://domain.com/wp-content/uploads/2011/02/book06.jpg” class=”attachment-post-thumbnail wp-post-image” alt=”book06″ title=”book06″ /> Here I want grab the src only. How do I filter the_post_thumbnail() only to get http://domain.com/wp-content/uploads/2011/02/book06.jpg Let me know 6 You might also try: If you only have one size thumbnail: $thumbnail = … Read more

How come Featured Image isn’t showing up in my Custom Post Type?

I have thumbnail support added with the following in my functions.php // Add Thumbnail Support add_theme_support(‘post-thumbnails’); set_post_thumbnail_size( 140, 140, true ); And I create the custom post type with // Create Custom Post Type for Work add_action( ‘init’, ‘create_post_type’ ); function create_post_type() { register_post_type( ‘custom_post’, array( ‘thumbnail’, ‘labels’ => array( ‘name’ => __( ‘Custom’ ), … Read more