How to crop image in customizer image field ?


Hello everyone,

Today I am going to illustrate on , how to cropped image on customizer.

Normally we use WP_Customize_Image_Control for selecting image on customizer section, but this doesn’t provide you the featured to cropped image on your requirement.
But WordPress provide us class called ‘WP_Customize_Cropped_Image_Control‘ which provide you the featured to crop a image.You can see full code here:
Before starting the tutorial I hope you all guys know how to add section, setting and control on customizer.
Step 1: First create section: Continue reading


How to make slider for woocommerce related product?


Hi everyone, today i am going to show you how to implement slider for woocommerce related products.

Required condition:
1> Here we are using bx slider so i hope you everyone know how to set up bx slider on our theme.
Here is the link:
2> All of you know how hook function on wordpress.

Here we start:

Our first steps is to align all the related products on single row so we are using [woocommerce_output_related_products_args ] hooks. And on customizer i have given user interface to select how many product to display on slider.For this you can see here:

Continue reading


How to make blog post protected?


Hello Guys, today i am going to explain you simple logic on making blog page passport protected.

Step 1: select one of the page as post page. You can select this from dashboard -> setting -> reading -> post page section


step 2: Then you need to find which template is in use to display post page. See here for template heirarchy

Continue reading


Customizer selective refresh is not working?


Hi Everyone,

We can get many tutorial and article in making selective referesh on customizer, which is introduced on WordPress Version 4.5.
Here is the answer of the question if you find your customizer selective referesh is now working even you followed the whole procedure that is given on wordpress codex or by many of our Admin member.

Continue reading


How to add custom image size with metabox?

Here is the procedure for adding custom image size on metabox/metafield of post

I hope you all are familiar with after_setup_theme theme hook. Here i first defined image size using add_image_size function:
//adding function_exists() before function will let user to customize the same function on child theme

if ( !function_exists( ‘theme_slug_image_size_for_metabox’)) :
function theme_slug_image_size_for_metabox(){

//set thumbnail image for recent post
add_image_size ( ‘themeslug-thumbnail-recent’, 80,100,true);
add_action(‘after_setup_theme’, ‘theme_slug_image_size_for_metabox’);

Continue reading

All Customizer panel & section lost


Today after updating my site to latest WordPress  version 4.5. i came along this issue. My customizer  preview init is totally blank with no section and panel. Along with i got this error on console

Uncaught TypeError: data.defaultValue.substring is not a function

How i solved this issue?

  • First I deactivated all plugin installed on a site to see if plugin is creating issue.
  • Then I dequeue  all the scripts from functions.php as well from customizer file where theme had added for creating customizer setting. To make sure which file is creating conflict i tried by removing file sequentially that is added on functions.php
  • After I found that the file where customizer setting for control,setting, panel and section is causing the problem.
  • Then to know if setting id is creating conflict i tried by changing all section id to different value then tracking one by one.
  • Finally I found setting id “widget_titles” is creating problems and changed to some XXXX id which solve the issue

After debugging for 3 hour finally i found the solution of the problems.

Conclusion: Always name options id,setting id and  , functions  prefixing with theme or plugin slug. It will prevents your id conflicting to other third party or WordPress core itself.


Sushil Adhikari

Error on WordPress


While debugging WordPress site, i found the following bug  that are really frustrating and brain storming.

  1. Grid mode may not work on media library
  2. Media gallery will  remain loading
  3. Admin panel may goes blank on switching theme or your front-end will remain totally blank without any error. Even if you had enable wp_debug mode.
  4. Widgets automatically close after clicking to dropdown icon
  5. Header already sent

If you face any problems like this you try by  following this  practice:

  1. Check whether you have included some js on head or on body  section without using wp_head hook or without wrapping  to any hook of WP.
  2. Always make a habit of using less closing and opening of php tag.  Here is the example:

Continue reading


What are hooks on WordPress?


, , ,


Most of the people may gone through many article on filter or action hook, but still can’t get concept on hook of WordPress , then you are on the best place to learn.

Here i am not going to illustrate about basic theoritical meaning of hooks, just i will provide simple demonstration on hooks.

Before starting i hope you guys are clear on working of function of php.

Hooks are actually comes on action as calling and called function.

Continue reading