Which function crops images in wordpress?

The image goes through multiple processes for the thumbnail to be generated. Take a look into the WP_Image_Editor class in the wp-includes/class-wp-image-editor.php. This class handles cropping, resizing, etc. There is a public function inside this class, named crop(). This might be what you are after. However, the actual resizing is handled by the function multi_resize(), … Read more

Modify RSS – remove image and add text

Note that the_permalink_rss() and the_excerpt_rss() do echo the output, not return it. With your current snippet, replace the_excerpt_rss() with: apply_filters( ‘the_excerpt_rss’, get_the_excerpt() ); and replace the_permalink_rss() with: esc_url( apply_filters( ‘the_permalink_rss’, get_permalink() ) ); You could also use: <content:encoded><![CDATA[ <?php the_excerpt_rss(); ?> <a href=”https://wordpress.stackexchange.com/questions/245310/<?php the_permalink_rss(); ?>”> <?php esc_html_e( ‘Read more’, ‘mydomain’ );?> </a> <?php esc_html_e( ‘at’, … Read more

Media gallery images url instead of ID on WP API Response

This is the correct way to achieve it is this: function show_main_image($object, $field_name, $request){ $custom_fields = get_post_custom($object[‘id’]); $main_image = $custom_fields[‘main_image’]; $arregloimg = explode(‘,’,$main_image[0]); $image_urls = array(); foreach ( $arregloimg as $key => $value ) { $image_urls[] = wp_get_attachment_url($value,’thumbnail’); }; return $image_urls; }

Image change on hover

This isn’t really a WordPress-specific question, but generally you can do something like this via CSS (depending on the structure of the image). Generally, you’ll have an easier time doing this if the image in question is being applied as a background image to a DIV, rather than as just a standard img tag. Then, … Read more

How to loop through all the attached images in a post, and get their url one by one

Put this in the template file at the beginning or in functions.php file: function get_images_attachment_url() { global $post; $images_urls = array(); $images_objects = get_attached_media( ‘image’, $post->ID ); foreach ($images_objects as $image_object) { $images_urls[] = wp_get_attachment_url ($image_object->ID); } return $images_urls; } When you need to call them use foreach after calling the function get_images_attachment_url(): $my_images_urls = … Read more

How to fix a missing image

The code of your site shows that the HTML is referencing your developer’s server for the logo. They must have cleaned up and deleted that server installation recently. You’ll need to re-upload a logo to your own media library.