Skip to main content

Posts

Activate windows 10 for Microsoft surface pro

 Follow the below instructions to activate windows 10 on microsoft surface pro. This also will remove the watermark that says "Activate Windows" Try following the below steps to activate: Windows 10 came preinstalled on my computer, how do I find the product key? 1. Press Windows key + X 2. Click Command Prompt (admin) 3. Enter the following command: wmic path SoftwareLicensingService get OA3xOriginalProductKey 4. Hit Enter 5. The product key will be revealed, copy the product key 6. Click Start > Settings > Update & security > Activation > Change the product key then enter the product key then click Next to Activate
Recent posts

Hide a product from WooCommerce main shop page

 function custom_pre_get_posts_query( $q ) {     $tax_query = (array) $q->get( 'tax_query' );     $tax_query[] = array(            'taxonomy' => 'product_cat',            'field' => 'slug',            'terms' => array( 'buster' ), // Don't display products in the clothing category on the shop page.            'operator' => 'NOT IN'     );     if(is_shop()){     $q->set( 'tax_query', $tax_query );   }else{     return;   }      } add_action( 'woocommerce_product_query', 'custom_pre_get_posts_query' ); 

How to allow ".WEBP" images in WordPress by coding

 Normally, WordPress does not allow to uploading of .webp format image files. But in some cases, we need to use that format. In order to allow the format to be used in WordPress, we need to add some coding in functions.php in the active theme. The following code needs to be added in the bottom of all codes in functions.php in the active theme. function webp_upload_mimes( $existing_mimes ) { // add webp to the list of mime types $existing_mimes['webp'] = 'image/webp'; // return the array back to the function with our added mime type return $existing_mimes; } add_filter( 'mime_types', 'webp_upload_mimes' ); These lines of code will allow uploading .webp format images but the thumbnail could not be seen from the WordPress dashboard. In order to view the thumbnail, we need to add an additional piece of code at just the bottom of the above code. //** * Enable preview / thumbnail for webp image files.*/ function webp_is_displayable($result, $p...

Set WordPress custom excerpt from Rank Math SEO plugin

  Sometimes, we need to set different excerpts for showing posts on the blog page. In this post, we are going to share a piece of code that works perfectly to change a posts' excerpt programmatically.  function rankmath_post_excerpt(){         $id = get_the_ID();         $post_type = get_post_type( get_the_ID() );         if ($post_type == 'post') {             $meta_description = get_post_meta($id,'rank_math_description',true);             return $meta_description;          }else{             return;         }          } function check_for_rankmath_activation(){     if ( is_plugin_active( 'seo-by-rank-math/rank-math.php' ) ){         add_filter('get_the_excerpt', 'rankmath_post_excerpt' );         add_filter('t...

How to make woocommerce pages accessible to logged in users only

Sometimes we need to set up private online shop. The easiest and fastest way to set up an online shop is to set up WordPress with WooCommerce. In WordPress, we can easily add a functionality that prevents guest users to access the products/shop page. Here is the code which needs to be in functions.php in theme files. function guest_user_redirect() {     if (! is_user_logged_in() && (is_woocommerce() || is_cart() || is_checkout())) {         wp_redirect(home_url());          exit;     } } add_action('template_redirect', 'guest_user_redirect');

Create two separate menu items for logged in and logged out users for WordPress

We can place two separate menu items for same position in WordPress. That means, if a user logged into the website, the user will see the available menus for logged in users. When the user log out from the website, he/she will se different menu which is for all guests. To do that, simply create two menu from WordPress dashboard. It could contain any name of your choice. For example, the name of the menus could be "for logged in users" and "for logged out users". Then, you have to declare the menu locations, for example:  register_nav_menus( array( 'loggedin' => esc_html__( 'Logged In Menu', 'theme_name' ), 'loggedout' => esc_html__( 'Logged Out Menu', 'theme_name' ), ) ); This will add the options on menus page. Next, after assigning the menus to the respective menu locations, we have to show the menu in the theme:  $args = array(                         'theme_location' => 'loggedin', ...

Most common mistakes while using wordpress

  1. Not Taking a Backup 2. Testing New Products on a Live Site 3. Not Securing your WordPress Backup 4. Not using Permalinks 5. Using Cheap Web Hosting 6. Installing Too Many Plugins 7. Frequent Theme Changes 8. Installing WordPress In A Subfolder Called ‘wordpress’ 9. Using ‘admin’ As A Username 10. Using Weak Passwords