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

How do I add a default thumbnail to elseif when no get_field(‘photos’), and no post thumbnail exists?

The function you are looking for is has_post_thumbnail() With this function you can check, if a featured image has been attached to a post and perform the following code: <?php if( get_field( ‘photos’ ) ): ?> <div class=”img”> <?php echo ‘<a class=”image” href=”‘ . get_permalink() . ‘”><div class=”img”><img src=”‘ . $model_pic[0][‘sizes’][‘models’] . ‘” /></div><div class=”info”><h3>’ … Read more

Resize image to specific dimension (X to Y ratio)

If the last parameter $crop is true, then »images will be cropped to the specified dimensions using center positions«, with »(…) an array can specify positioning of the crop area« – this is generally called hard crop. But you have to make sure that the images are big enough to actually crop the size you … Read more

Image getting out of container [closed]

Change hentry CSS and add overflow to hidden. Like this. .hentry { margin: 0px 0px 0.5em; padding: 5px 0px 0em 0.4em; border-bottom: 1px solid #ccc; overflow: hidden; } This will fix the issue of image being getting outside of the article container.