WordPress – different icon image depends of comment number

There is a ready function for doing such action: Take a look here: https://codex.wordpress.org/Function_Reference/wp_count_comments This should really sole your problem as you can use an if statement deciding the picture, just remember you have to use the post_id in order to get the count. Thank you!

After installing ssl certificate images won’t show

I suppose you have Adaptive Images plugin installed? The author suggests for now: Can you check if the urls in your admin Settings > General page do contain the “https” instead of “http”? They should contain the “https” and (sorry about this inconvenience) you need to update your Adaptive Images settings one more time after … Read more

Is my code is right to make image shortcode

Your code is right just need to change $atts variable. // if you want to add image, alt attribute on shortcode statically $atts = shortcode_atts( array( ‘image_src’ => ”, ‘alt’ => ”, ‘add_img_class’ => ”, ‘id’ => ” ), $atts, ‘hero-banner’ ); // if you pass image and alt attribute dynamically $atts = shortcode_atts( array( … Read more

Adding new size for Media screen in functions.php not working

Change your function to this. function wpshout_custom_sizes($sizes) { $sizes[‘medium-width’] = __( ‘Medium Width’ ); $sizes[‘medium-height’] = __( ‘Medium Height’); $sizes[‘medium-something’] = __( ‘Medium Something’); return $sizes; } add_filter( ‘image_size_names_choose’, ‘wpshout_custom_sizes’ );

Replace original image, WP image editor

What you want is probably something like this. You need to manually unlink the original image including added sizes. The WP image editor automatically creates a new image with a new name as you mentioned but not others added through add_image_size() function. regenerate_added_sizes() in the code below does exactly that: function replace_original_images( $override, $filename, $image, … Read more

Woocommerce featured image of page – not product

Thanks to you I tried this on my functions.php It worked, but also had to get the ID of the page, in my case 4. add_action( ‘woocommerce_before_main_content’, ‘woocommerce_category_image’, 2 ); function woocommerce_category_image() { if ( is_product_category() ){ global $wp_query; $cat = $wp_query->get_queried_object(); $thumbnail_id = get_term_meta( $cat->term_id, ‘thumbnail_id’, true ); $image = wp_get_attachment_url( $thumbnail_id ); if … Read more

Remove Size images without use

Yes, just search for a specific image size within the theme files. The text editors like Atom, BBEdit, Notepad++ allows to do that. P.S. You can find image size name in add_image_size() function argument.

Make medium_large images available to insert into post

since I’m using a size already generated by WP, I just needed to add: add_filter( ‘image_size_names_choose’, ‘fresh_custom_sizes’ ); function fresh_custom_sizes( $sizes ) { return array_merge( $sizes, array( ‘medium_large’ => __( ‘Medium Large’ ), ) ); }

upload featured image in custom post type from frontend

You are using the wp_insert_attachment() function, which states the following in the Codex: This function is part of the low-level API used by WordPress for handling attachments. To perform the entire attachment upload and insertion process at once, you will want to use media_handle_upload() instead in most cases. So to automatically generate the image resizes … Read more

Host images only on CDN

I’ve never heard of a CDN that replaces your servers storage completely, only mirroring. However, I know (as I’ve done this on multiple installs) you can offload your current and future media library items to AWS S3 with a plugin like Media Cloud. Media items get off of your pricy and limited hosting server, and … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)