Tag Info

Hot answers tagged

3

You can make use of the custom field parameters in WP_Query like you have, you just need to extend it a bit further You can do your sorting by post_views_count and use meta_query to get all posts that has the highest post view count and has a post thumbnail You can probably try something like this $args = array( 'order' => 'DESC', ...


1

You can put your code wherever you want to show the sidebar like on header or on left or right based on your theme file. if ( function_exists( 'dynamic_sidebar' ) && dynamic_sidebar( $selected_sidebar_replacement) ) { /*code to display featured image here*/ global $post; if ( has_post_thumbnail( $post->ID ) ) echo ...


1

This happened to me. I installed a thumbnail regenerater plugin, this seemed to do the job for me.


1

I just created a plugin because I had the same problem. You can download it from here: https://wordpress.org/plugins/delete-original-image/


1

Try just using the traditional $i iterator (untested) but I can't see why this wouldn't work.. <?php $i = 0; while ( have_posts() ) : the_post(); $i++; if ( $i == 1 ): ?> <!-- First Post --> <div id="post"> <a class="post_image" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"> ...


1

What add_theme_support( 'post-thumbnails', array( 'products' ) ); did is: it added the support for the post-thumbnail feature, and with the second parameter you fixed the feature support to only post_type = 'products'. But it actually saying: Ok, load all the necessary things to register a Post Thumbnail — you're actually introducing 'Post Thumbnail' ...


1

You can use add_image_size() function to create custom sized images. You only need to paste some piece of codes in your functions.php and then update the template files accordingly. For example : add_image_size( 'category-thumb', 300 ); // 300 pixels wide (and unlimited height) add_image_size( 'homepage-thumb', 220, 180, true ); // (cropped) And you ...


1

Unsetting sizes can normally be done easily via intermediate_image_sizes_advanced hook. Only problem there is only the $sizes array available, so this sufficient for a general level, but not if you want to do this conditionally. The information needed to do it conditionally could be gathered with debug_backtrace - note: if there is another way, that I'm ...


1

I edited code if (!function_exists('wp_generate_attachment_metadata')){ require_once(ABSPATH . "wp-admin" . '/includes/image.php'); require_once(ABSPATH . "wp-admin" . '/includes/file.php'); require_once(ABSPATH . "wp-admin" . '/includes/media.php'); } if ($_FILES) { foreach ($_FILES as ...


1

Those might be old images. Image uploaded to WordPress before adding this new image size code will not resize automatically. You will have to resize old images again. There is a great plugin for that. Use Regenerate Thumbnails plugin to auto generate thumbs for all images. If you ever add a new image size then always resize images again with this plugin.



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