How To Pick Custom Size Of Uploaded Image In Theme Via the_post_thumbnail();?

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 can use … Read more

Getting thumbnail of uploaded image

Where are you attempting to get the image? That should be the correct function: global $post; $image = get_the_post_thumbnail( $post->ID ); It will return an array of all the image sizes for that given image. You can then grab the image size out of the array, or better yet pass in a specific image size … Read more

Make featured image be shareable across multiple pages?

You could easily do this by hooking into the save_post action and updating the featured image custom field. In your functions.php file, add the following code: function interit_featured_image( $post_id ) { // Get Parent ID $parent_id = wp_get_post_parent_id( $post_id ); // Only proceed if this page has a parent if ($parent_id != 0) : // … Read more

Load Gallery Images with Title on Homepage BX Slider

I would recommend using this plugin instead: https://wordpress.org/plugins/cpt-bootstrap-carousel/ It works well with the built-in Twitter Boostrap 3 in Roots.oi theme (Responsive) and it comes along with a CPT named carousel. Looking in your code: The get_post_gallery_images() function only returns the url and it doesn’t contain any Gallery Image Title content.

Multiple post image, echo url (path of image)

found the solution: <div class=”fill” style=”background-image:url(‘<?php $custom = MultiPostThumbnails::get_post_thumbnail_id(get_post_type(), ‘header-image’, $post->ID); $custom=wp_get_attachment_image_src($custom,’header image’); echo $custom[0]; ?>’);”></div>

How to display title of attached image in post?

First you need to get your attached image ID, how you get it depends on how you’re setting the image. The generic idea is that you get the attachment ID then you can simply use get_the_title( $attachment_id ). If you’re setting it as a Featured Image ( Post Thumbnail ) then you can use the … Read more

How do you import images from a URL in your post?

You could create a small plugin for this, here is an small example that will try to download and attach a file based on the url in the excerpt field for the post: add_action(‘publish_post’, ‘auto_featured_image_publish_post’); function auto_featured_image_publish_post($post, $post_id) { // check if this post is saved for the first time if($post->post_date == $post->post_modified) { // … Read more