Articles of thumbnails

Thumbnail generating and posting

I have PHP code that generates a thumbnail, but it crops out the wrong part of the image and displays wrong. How does it know what part to crop out, and how do I fix that to crop out the portion of the image I want? Here is the code: if ( has_post_thumbnail() ) { […]

Echo list attachment size in post

i have a post width 10 attachment image in post i want querylist 10 attachment in post as: <li><a href=”url-img-attachment-sizefull-img1″ title=””><img src=”url-img-attachment-sizethumb-img1″></li> <li><a href=”url-img-attachment-sizefull-img1″ title=””><img src=”url-img-attachment-sizethumb-img1″></li> ….. Give any code. My code add: <?php query_posts($args); if (have_posts()) { while (have_posts()) { the_post(); ?> <?php $args = array( ‘post_type’ => ‘attachment’, ‘numberposts’ => 3, ‘orderby’ => […]

add_image_size not working

I am trying to resize an image using either the following code: add_image_size(‘poster-full’, 450, 9999, false); OR add_image_size(‘poster-full’, 450); I need it to be resized widthwise, and height should be proportional. When, I go and Run the Regenerate Thumbnails Plugin, i see that the image is resized correctly. For both the above cases. But, when […]

Featured image on post edit page not loading over HTTPS

Our site uses TLS and to the best of my ability I’ve forced TLS everywhere. I’ve defined FORCE_SSL_ADMIN to be true and also tried the following filter which I’ve borrowed from the plugin SSL Insecure Content FIxer ( function fix_ssl_attachment_url( $url ) { if ( is_ssl() ) { if (stripos($url, ‘http://’) === 0) { $url […]

Category page with thumb is ok but can't do the same with tags

I got a wp theme that can display a category page with thumbs (of posts) $cat_args = array( ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, // ‘number’ => $num, ‘child_of’ => 0, ‘show_count’ => 1 ); $categories = get_categories($cat_args); foreach($categories as $category) { echo ‘<a href=”‘ . get_category_link( $category->term_id ) . ‘” title=”‘ . sprintf( __( […]

How to move image thumbnails into custom folder for custom post type

I have adapted Philipp’s answer here to move all thumbnails to a custom folder. How do we make this work for a particular custom post type? function custom_rename_images($image) { // Split the $image path $info = pathinfo($image); $dir = $info[‘dirname’] . ‘/’; $ext = ‘.’ . $info[‘extension’]; $name = wp_basename($image, ‘$ext’); if(!is_dir($dir.’_thumbs’)){ mkdir($dir.’_thumbs’); } // […]

Using Image Sizes for Custom Post Types outside the Loop

I want to use an image size on a Custom Post Type (which has featured image enabled). in functions.php I added: add_theme_support( ‘post-thumbnails’ ); add_image_size( ‘my-non-working-size’, 600, 300, true ); The custom post type is called ‘homeslide’ as I use it to build a a carousel slider on home. To get all my slides I […]

Can we use featured image as third party website image URL

In my case we are getting some post list from third party and import in our custom post type. My question is, Is we can use post featured image as third party website image URL instead of upload featured image.

how to nest specific category thumbnails inside different containers

im kinda new in wordpress and this is the problem im facing: I’ve created a custom div with 3 tabs that displays 3 inner containers, each tab is for a a specific “Category”. For Example, let’s call the categories cs:go, cod and fifa. What I want to do is to put thumbnails of a specific […]

Show image in excerpt post. Image not displaying

I am editing a costum theme. I was trying to add excerpt to the homepage. The homepage is costum. The excerpt show just fine but the image refuses to be displayed it seems. This is my code: $args = array( ‘numberposts’ => 5, ‘category’ => 3,4,5,6,7 ); $posts = query_posts( $args . ‘&orderby=date&order=desc’ ); foreach( […]