Tag Info

Hot answers tagged

2

First get the registered image sizes and the featured image attachment id: $sizes = get_intermediate_image_sizes(); $post_thumbnail_id = get_post_thumbnail_id(); Loop through the registered sizes and create an array: $images = array(); foreach ( $sizes as $size ) { $images[] = wp_get_attachment_image_src( $post_thumbnail_id, $size ); } Combined as ...


2

Since this is a plugin, it's probably going to get axed, but generally speaking in WordPress if you want to get a posts featured image and you have access to the post ID (which I'm assuming you do), you can always do this: $thumb_url = wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) ); So without looking at the plugin, it looks like you might ...


1

I found the solution from a Wordpress forum and this is what they used. Works perfect <?php if (has_post_thumbnail( $post->ID ) ): ?> <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), '' ); $image = $image[0]; ?> <?php else : $image = get_bloginfo('stylesheet_directory') . ...


1

You are using wrong Comparison Operators. Use else if($author_id == "2") { instead of else if($author_id = "2") { Edit: Try adding trailing slash after get_stylesheet_directory_uri function. its missing in your code. <img src="<?php echo get_stylesheet_directory_uri() ?>/images/default-thumb.jpg" alt="" title="" width="" height="" />



Only top voted, non community-wiki answers of a minimum length are eligible