Send email notification when meet the condition

You can use this code to automatically send an email whenever a post of the type one is published. This goes into your theme’s functions.php : <?php function post_published_notification( $ID, $post ) { $type = get_post_type($ID); if ($type == ‘post-type-one’){ $author = $post->post_author; /* Post author ID. */ $name = get_the_author_meta( ‘display_name’, $author ); $email … Read more

Add country flags

Best solution is to import data from 3rd party API into your database. By this you do not need to rely on any API. Your page performance will also be increased as it will reduce external request. So you need to do one time job to fetch all the data from API, stores it into … Read more

Generate all urls with https

This sounds like a bug in the plugin, and they should fix it. But if they don’t, you can always add a filter to home_url and change all http:// to https:// like so: add_filter( ‘home_url’, ‘wpse_259675_home_url’, 1000, 4 ); function wpse_259675_home_url( $url, $path, $orig_scheme, $blog_id ) { return str_replace( ‘http://’, ‘https://’, $url ); }

How to make temporary expiring link for a downloadable file

Option 1: You can achieve this using htaccess if you have single download file/path. But if you have more files available for download. Creating a temporary file for each download requests and using htaccess is not a good idea. $path=”uploads/”; $actualfilename=$path.$filename; $fakefilename=”downloadfile.pdf”; if($typeofview==”download”) { @readfile($actualfilename); header(‘Content-type: application/pdf’); header(‘Content-Disposition: attachment; filename=”‘ . $fakefilename . ‘”‘); header(‘Content-Transfer-Encoding: … Read more

‘Save settings’ (submit button) ISSET

You question is not well explained, what you want to achieve, here is the suggestion, you can add JS event ONClick into you submit button and define the JS function according to your goals, (for example you want to count submit button click) <script type=”text/javascript”> var clicks = 0; function onClick() { clicks += 1; … Read more