How to make slider for woocommerce related product?

woocommerce_logo1

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: http://bxslider.com/
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: https://sushilwp.wordpress.com/2016/01/31/how-to-change-number-of-woocommerce-related-through-customizer-setting/

Continue reading

Advertisements

Image

How to make blog post protected?

slide1-600x290

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

display-blog

step 2: Then you need to find which template is in use to display post page. See here for template heirarchy https://developer.wordpress.org/themes/basics/template-hierarchy/

Continue reading

Image

Customizer selective refresh is not working?

theme-customization

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

Image

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:
example:
//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);
}
endif;
add_action(‘after_setup_theme’, ‘theme_slug_image_size_for_metabox’);

Continue reading

All Customizer panel & section lost

theme-customization

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.

Thanks

Sushil Adhikari

Error on WordPress

error

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

Image

What are hooks on WordPress?

wp-hooks-guide

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