What can i do add title to ‘large’ image?

Check the Codex. the_post_thumbnail accepts two parameters, the second of which is $attr— “attributes”. the_post_thumbnail(‘full’,array(‘title’=>’yay! a title!’)); The Codex entry for the_post_thumbnail is not clear on what is and is not allowed as an “attribute” but it appears to depend on wp_get_attachment_image and by filters applied by that function. title does work though. I checked.

images not showing despite using add_theme_support(‘post-thumbnails’);

Since you appear to be using Featured Images, replace this: <div class=”post-image”> <?php echo ravs_get_custom_image( get_post_thumbnail_id () ); ?> </div><!– end post-image –> with this: <div class=”post-image”> <?php if ( has_post_thumbnail() ) { the_post_thumbnail( ‘custom-image’ ); } ?> </div> References Codex: has_post_thumbnail() the_post_thumbnail()

Choose to Display Post Thumbnail?

This is modified code from twentyten that does what you’re looking for. Put this in header or wherever you want the image to run. See string post-thumbnail — that is size. Make sure it is defined as 940 x 180 in functions.php if ( is_singular() && current_theme_supports( ‘post-thumbnails’ ) && has_post_thumbnail( $post->ID ) && ($image … Read more

Only Display a Featured Image on First Post Page

Use the global $page, which holds the current page number. // Somewhere near the top if ( $GLOBALS[‘page’] === 1 && $image_data = get_post_thumbnail_id() ) { if ( $image_data = wp_get_attachment_image_src( $image_data, ‘full’ ) ) { if ( $image_data[1] >= 500 ) the_post_thumbnail( ‘top-post’ ); } } // Further down. $image_data still exists, no need … Read more

Cropping images from top center using Jetpack Photon

We discussed about this issue in the WordPress.org support forums. Here is a code that should do the trick: /* * Let’s add support for Photon – that won’t be necessary once Jetpack 2.3.2 is out. * You’ll be able to use apply_filters( ‘jetpack_photon_url’… directly * See http://jetpack.me/2013/07/11/photon-and-themes/ */ if( function_exists( ‘jetpack_photon_url’ ) ) { … Read more

Featured Image If Else Condition

Change your code to: <div id=’xpro_shell_text’ > <?php if ( has_post_thumbnail( $post->ID ) ) : $imageInfo = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), ‘single-post-thumbnail’ ); $imageUrl = $imageInfo[0]; else: $imageUrl = get_template_directory() . ‘PATH TO YOUR DEFAULT IMAGE’; endif; ?> <div id=”xpro_shell_content_header” class=”content_about_us_header white” style=”background:url(‘<?php echo $imageUrl; ?>’) no-repeat;”> <div id=’xpro_shell_content_header_blurb’> <h1 class=”greenHeader cufon_reg”> <?php the_title(); ?> … Read more

How to disable thumbnail filter for a specific template part or image size?

Probably the simplest solution is to remove the filter before output: // remove the filter remove_filter(‘post_thumbnail_html’, ‘_sf_responsive_img’, 5, 5); // output template get_template_part( ‘something’ ); // add the filter back on if other code below outputs thumbs that need the filter add_filter(‘post_thumbnail_html’, ‘_sf_responsive_img’, 5, 5);

Show posts image attachments

See the below code. <?php $args = array( ‘posts_per_page’ => -1, ‘order’=> ‘DESC’, ‘orderby’ => ‘date’ ); $postslist = get_posts( $args ); foreach ( $postslist as $post ) : setup_postdata( $post ); ?> <div> <?php $args = array( ‘post_type’ => ‘attachment’, ‘posts_per_page’ => -1, ‘post_status’ =>’any’, ‘post_parent’ => $post->ID ); $attachments = get_posts( $args ); … Read more

3 random images from custom post type, each in a div with a diffrent class

Getting different classes in the divs is relatively simple and mostly not a WordPress question, but there are WordPress bits to it that need comment. Truncated code reformatted for legibility: $classes = array( ‘side left’, ‘middle’, ‘side right’ ); $qry = new WP_Query( array( ‘post_type’=> ‘portfolio’, ‘posts_per_page’ => 3, ‘orderby’ => ‘rand’, ‘order’ => ‘ASC’ … Read more