Correctly implementing the Facebook Like button

Yoast.com actually covered this quite recently… if ( is_singular() ) { global $post; if ( current_theme_supports(‘post-thumbnails’) && has_post_thumbnail( $post->ID ) ) { $thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), ‘thumbnail’, false); echo ‘<meta property=”og:image” content=”‘.$thumbnail[0].'” />’; } echo ‘<meta property=”og:title” content=”‘.get_the_title().'” />’; if ( get_the_excerpt() != ” ) echo ‘<meta property=”og:description” content=”‘.strip_tags( get_the_excerpt() ).'” />’; } … Read more

TImthumb not working for absolute path

I always do this with Timthumb: // this is the absolute path $url=”http://crizaze.com/wp-content/themes/joorang/wp-content/uploads/2011/01/ami166a-e1295733091216.jpg”; // convert it into relative path $url = str_replace(get_bloginfo(‘url’), ”, $url); // get the image url, resized by timthumb $timthumb_url = get_stylesheet_directory_uri() . “/timthumb.php?src=$url&w=80&h=80”;

WordPress 3.0 embedded images

You actually can, there’s a field on the upload image named “Link URL” which you can leave blank or just click the “None” button when you upload or edit an image in a post. Is this what you mean?

Native gallery sorting is ignored

The Problem was caused by the plugin “Post Types Order”. It takes control over all post orders including the order within galleries. Since there does not seem to be an option to exclude galleries properly, you will have to deactivate the plugin to have control over the gallery order again.

How to check for images before echo

wrap the html output in the conditional like this: <?php $image = wp_get_attachment_image_src(get_field(‘post_image1’), ‘thumbnail’); if( $image !=false ) { ?> <img src=”https://wordpress.stackexchange.com/questions/60013/<?php echo $image[0]; ?>” alt=”<?php get_the_title(get_field(‘post_image1’)) ?>” /> <?php } $image = wp_get_attachment_image_src(get_field(‘post_image2’), ‘thumbnail’); if( $image !=false ) { ?> <img src=”https://wordpress.stackexchange.com/questions/60013/<?php echo $image[0]; ?>” alt=”<?php get_the_title(get_field(‘post_image2’)) ?>” /> <?php } ?>

How can I change get_the_post_thumbnail to make 100% width image?

I ended up using the following to solve my problem. <?php $image_id = get_post_thumbnail_id(); ?> <?php $image_attributes = wp_get_attachment_image_src( $image_id, ‘full’); ?> <img src=”https://wordpress.stackexchange.com/questions/65569/<?php echo $image_attributes[0]; ?>” width=”100%”>