Tag Info

New answers tagged

0

I ended up using the "Multiple Post Thumbnails" plugin which I'm quite happy with: https://wordpress.org/plugins/multiple-post-thumbnails/


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' ...


0

change true to false in set_post_thumbnail_size( 760, 330, true ) add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 760, 330, false ); This will make it not crop automatically.


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

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


0

I fixed it by just removing the function that threw the error. I have not seen any implications yet. Image upload is working perfectly now.


0

You shouldn't have to reload anything you will need to hook this fucntion into a hook so it's actually run something like this should do it: do_action( 'init', 'toolbox_setup' ); http://codex.wordpress.org/Function_Reference/do_action


1

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


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 ...


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

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.


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 ...


0

I guess the answer to your question is really well documented in the code you're using: //and if you want to set that image as Post then use: update_post_meta($post_id,'_thumbnail_id',$attach_id); So all you have to do is to comment the following line: update_post_meta($post_id,'_thumbnail_id',$attach_id);


0

Your code seems to take it for granted that a thumbnail actually exists for any post that your query retrieves. I would personally recommend checking for the existence of a featured image before attempting to retrieve it. <a href="<?php the_permalink(); ?>" itemprop="url"> <img src="<?php get_the_post_thumbnail('custom-medium'); ...


0

Not sure how you do it in your single.php, but I'm fairly certain not the same way. The main problem is that both the_post_thumbnail() and get_the_post_thumbnail() are generating the img tag output for you - so putting it into the src attribute of an img tag like in your code can't work. Additionally: The latter does return, the former does echo the output. ...


0

So i followed this link how-to-get-larger-images-in-a-wordpress-gallery and i changed the Thumbnail size to 300px with 300px from SETTINGS -> MEDIA, and then run a Regenerate Thumbnails. Now the thumbnails are ok by using the code <?php the_post_thumbnail( array(300,300) ); ?>


0

The best solution for this is Timthumb(https://code.google.com/p/timthumb/) or you can check this post where they did something on fly and it's working also https://wordpress.org/support/topic/add-image-size-doing-width-but-not-height-or-crop


0

You need to crop by height. I believe passing two values as 300 means WP will look what the most is that is can resize the image to before it exceeds 300px in either width of height. Try this (untested); add_image_size( 'custom_image_size', 9999, 300, true ); As the others have said, your code won't work unless the original image is large enough to work ...


0

As the two comments above said: The Uploaded Image has to be larger than 300px * 300px to get 300px * 300px at the end. WordPress just scales down Images, but does not scale up Images.


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 ...


0

If your theme has support for Post Thumbnails the "Featured Image" metabox will be visible on the on the Edit Post and Edit Page screens. If it isn't, make sure "Featured Image" is enabled in the screen options on the top right. After clicking the "Set featured image" link insert image. Once you have selected the featured image and determined the image ...



Top 50 recent answers are included