HOME / BLOG

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’);  

Basic animated circular progress bar using svg, html, css, jquery

<svg id=”animated” viewbox=”0 0 100 100″> <circle cx=”50″ cy=”50″ r=”45″ fill=”#FDB900″/> <path id=”progress” stroke-linecap=”round” stroke-width=”5″ stroke=”#fff” fill=”none” d=”M50 10 a 40 40 0 0 1 0 80 a 40 40 0 0 1 0 -80″> </path> <text id=”count” x=”50″ y=”50″ text-anchor=”middle” dy=”7″ font-size=”20″>100%</text> </svg> body{text-align:center;font-family: ‘Open Sans’, sans-serif;} svg{width:30%;} var s = Snap(‘#animated’); var progress […]