how to make jpg downdable in wordpress?

By default a user can save any image by right clicking on it in their browser and selecting “Save Image…” or similar. HTML5 offers a download attribute to the <a> element that will attempt to force the browser to download the image. So your resulting HTML would look like this: <a href=”https://wordpress.stackexchange.com/questions/293568/{{ url of image … Read more

Count posts on multisite with blog id

In order to use wp_count_posts() as you would on a single site, pass the blog id into the switch_to_blog() function before calling wp_count_posts(). Example: function wpse_get_post_count( $blog_id ){ switch_to_blog( $blog_id ); $post_count = wp_count_posts(); restore_current_blog(); return $post_count; } Ensure restore_current_blog() is used after every switch_to_blog() or you will risk difficulties mentioned in the notes section … Read more

Defined WordPress Memory Limit to Unlimited

If you search WP source code, you’ll find _MEMORY_LIMIT in wp-includes/default-constants.php $current_limit = @ini_get( ‘memory_limit’ ); $current_limit_int = wp_convert_hr_to_bytes( $current_limit ); //.. if ( ! defined( ‘WP_MAX_MEMORY_LIMIT’ ) ) { if ( false === wp_is_ini_value_changeable( ‘memory_limit’ ) ) { define( ‘WP_MAX_MEMORY_LIMIT’, $current_limit ); } elseif ( -1 === $current_limit_int || $current_limit_int > 268435456 /* = … Read more

Theme activation hook in php class

It looks like you are adding the hook just inside the body of the class. Try adding it into an init() method and calling it after it is instantiated or at the very least in the constructor. I think the issues is that the hook is being registered before the class has been fully read … Read more

Widget back end radio button issue

You got that problem because the radio buttons have different name; i.e. the_style_1 and the_style_2. So I’d suggest you to use the_style as the name for both the radio buttons: <p> <input class=”radio” type=”radio” <?php checked( $instance[ ‘the_style’ ], ‘style_1’ ); ?> id=”<?php echo $this->get_field_id( ‘the_style_1’ ); ?>” name=”<?php echo $this->get_field_name( ‘the_style’ ); ?>” value=”style_1″ … Read more