New answers tagged

-1

so you can do that in 2 different ways 1. modify directly on template-parts/content-single.php 2. you can plug it using the add_action(pre_get_post,func_with_your_staff ) inside this function func_with_your_staff( $query ) { global $wp ; if ( $query->is_single() && empty($query->post_type) $query->set('...


0

I have the same issue with not being able to turn off big_image_size_threshold (one of the worst new features WordPress has ever put out) for kicks I tried removing the quotes around return false but it doesn't resolve the issue. The example in Codex does in fact show quotes. https://codex.wordpress.org/Function_Reference/_return_false I have opened a ...


0

First, I would suggest you remove the images to see if the website loads considerably fast. After that's done, install "Autoptimize" and enable lazy load images(You can use any lazy loading plugin but Autoptimize works perfect for me due to the wide options) and then use webp images(Great compression but still really good quality). Webp Express is a free ...


0

To enable cropping for the medium images, it is enough to use this code: update_option( 'medium_crop', 1 ); The update_option() function itself checks whether such an option exists, and adds it if necessary: If the option does not exist, then the option will be added with the option value, with an $autoload value of yes.


0

I posted this on another very similar question here but thought it's worth reposting. I had issues with the code above and what worked for me was essentially changing these lines.: unlink($uploaded_image_location); rename($large_image_location, $uploaded_image_location); with: $file_to_be_copied = $large_image_location; $copied_file_name = $...


0

Try something like that The reverse of this: https://wordpress.stackexchange.com/a/209714/180599 <?php global $wpdb; //The reverse of this: https://wordpress.stackexchange.com/a/209714/180599 $supported_mimes = array( 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/tiff', 'image/x-icon' ); $all_mimes = get_allowed_mime_types(); $...


0

Rigidly crop vertically using the "height" style of the "pre" block ... for example, height = 85px


2

If you're trying to link the image to the page in the post editor you can click on the image and then click the link icon to set the target. You can do the same thing in HTML (in the editor in source view), in a plugin, or in a theme like this: <a href="/link/to/your/page"> <img src="/link/to/your/image" /> </a>


0

Yes, you can add the alt attribute. But there is a catch. When the theme is updated, all your changes or modification to the theme will be lost. It is recommended to make those changes in the child theme. You can learn more about WordPress child theme here


0

After dealing with this problem for almost a year, I finally solved it. It turned out to be a plugin after all. It was difficult to diagnose, since it happened so sporadically - sometimes not for months. But eventually, I found a certain post which was doing it with some regularity so I copied the site to a dev environment and went through the plugins one at ...


1

Take a look at wp_upload_dir here https://developer.wordpress.org/reference/functions/wp_upload_dir/ $upload_dir = wp_upload_dir(); var_dump( $upload_dir ); /* $upload_dir will comprise of the following return values: 'path' - (string) Base directory and subdirectory or full path to upload directory. 'url' - (string) Base URL and subdirectory or ...


0

Your PHP generates this html for gallery grid item: <div class="sh-image-gallery-item"> <div class="sh-gallery-item"> <div class="post-meta-thumb"> <img src="https://www.coleopterafarm.cz/wp-content/uploads/2019/12/PICT9418-660x660.jpg" alt="Carabus (Coptolabrus) smaragdinus brannicki"> <a class="sh-overlay-...


2

You can check mime type of uploaded image before upload to media. Add mimeTypes in $allowmimeType which you want to allow. then check uploaded files mimetype $fileMimeType. If not found in allowed mimetype then return false. // Insert Attachment function insert_attachment($file_handler, $post_id, $setthumb='false') { if ($_FILES[$file_handler]['error'] ...


0

Now I finded this in plugins.js title:null I tried to change that to title:'_wp_attachment_image_alt' but it just showed text "_wp_attachment_image_alt"


0

Media Cleaner WordPress Plugin is pretty good enough - https://wordpress.org/plugins/media-cleaner/ I like it as it has support for other plugins like Advanced Custom Fields (ACF), Divi Builder, Visual Composer and Elementor.


0

You could basically create a simple plugin, that will generate a shortcode. The function of this shortcode would be displaying the required images. You can choose between Ajax or maybe using the embedded PHP timer to trigger Ajax to retrieve the images. Then you embed this shortcode in your post or page (wherever you wish your images to be displayed). Good ...


Top 50 recent answers are included