woocommerce products slider – override theme

Q&ACategory: Pluginwoocommerce products slider – override theme
Ivan asked 2 years ago

Hi, is there a way to customize theme, for example flat theme and when update the plugin the customizations to be saved? I mean probably to put the theme files into some folder in main WP theme and override the plugin theme files?
 
Thanks

1 Answers
Hasan Staff answered 2 years ago

Yes, this quite possible.
you need some edit files to get it work properly.
Which theme you want to backup make a copy with unique name
woocommerce-products-slider/themes/
inside evry themes folder you will there two files and one folder as bellow

  • images/
  • index.php
  • style.css

Open index.php in any php editor see there is a function name wcps_body_(them_name) edit this name with your given unique theme(new) folder name
and save this file.
 
 
and then open “woocommerce-products-slider.php” inside woocommerce-products-slider/ root directory
in this file you need to add newly created folder files by require_once, see near line: 31-36
require_once( plugin_dir_path( __FILE__ ) . ‘themes/new_theme_name/index.php’);
 
and enqueue_style as like bellow near line: 61-66
wp_enqueue_style(‘wcps-style-new_theme_name‘, wcps_plugin_url.’themes/new_theme_name/style.css’);
and then add this newly created theme to short-codes logic at the end of else if near line: 136-140
            else if($wcps_themes== “new_theme_name“)
                {
                    $wcps_display.= wcps_body_new_theme_name($post_id);
                }
 
 
and finally open file wcps-meta.php insdie includes folder
woocommerce-products-slider/includes
add an option for newly created theme, near line: 330
<option class=”wcps_themes_new_theme_name” value=”new_theme_name” <?php if($wcps_themes==”new_theme_name“)echo “selected”; ?>>new_theme_name</option>
and you are done!!