How to enable allow CORS Policy Header in WordPress?

I’ve used a few different WordPress API’s – but for those of you using the ‘official’ WP-API, I had much trouble with this CORS — and what I found was that between the .htaccess approach and a few others I stumbled upon… adding this to your theme functions.php worked best. /** * Add this to your WordPress function.php […]

How to require minimum image upload dimensions condition for Woocommerce Products?

Add this code to your theme’s functions.php file, and it will limit minimum image dimentions /** * wpdevkit.in */ add_filter(‘wp_handle_upload_prefilter’,’tc_handle_upload_prefilter’); function tc_handle_upload_prefilter($file) { $img=getimagesize($file[‘tmp_name’]); $minimum = array(‘width’ => ‘640’, ‘height’ => ‘480’); $width= $img[0]; $height =$img[1]; if ($width < $minimum[‘width’] ) return array(“error”=>”Image dimensions are too small. Minimum width is {$minimum[‘width’]}px. Uploaded image width is $width px”); […]

How to replace wp-admin default logo with own custom logo

/** * paste this code in your function.php file , (by wpdevkit.in) */ function wpb_login_logo() { ?> <style type=”text/css”> #login h1 a, .login h1 a { background-image: url(http://wpdevkit.in/wp-content/uploads/2020/06/apple-touch-icon.png); height: auto; width: 300px; background-size: 100%; background-repeat: no-repeat; padding-bottom: 10px; border: none; height: 50px; padding: 0px !important; background-size: 100% 100%; } .wp-core-ui .button-primary{ background: #ff9900 !important; border-color: […]

How to insert code to header for a specific page only in wordpress?

/** * adding scripts for specific page/post with page id=17 (wpdevkt.in) */ function schemas_for_specifice_page(){ global $post; if($post->post_type == ‘page’ && $post->ID == ’17’){ echo ‘Your code here’; } } add_action(‘wp_head’,’schemas_for_specifice_page’);  

How to make a dynamic page loading bar with percentage using html, css, jquery ?

Make a dynamic page loading bar with percentage using html, css, jquery <div class=”preloader-wrap”> <div class=”percentage” id=”precent”></div> <div class=”loader”> <div class=”trackbar”> <div class=”loadbar”></div> </div> </div> </div> /** * preloader style */ .preloader-wrap { width: 100%; height: 100vh; position: fixed; top: 0; bottom: 0; background: #fff; z-index: 9999; } .percentage { height: auto; width: auto; border: […]

How to create a custom short code for getting data from database table in wordpress?

  // wordpress custom shortcode by wpdevkit.in function sdSlidesShortCode($attr){ $array = shortCodeAtts(array( ‘id’ => ”, ), $attr); global $wpdb; $table_name = $wpdb->prefix . “”; $id = $array[‘id’]; $results = $wpdb->get_results(“SELECT * FROM $table_name WEHERE ID = ‘$id'”); foreach($results as $result){ $slidesContent = $result->slidesContent; } $output = $slidesContent; return $output; } add_shortcode(‘SlideShortCode’,’sdSlidesShortCode’);