Tagged: child theme
-
AuthorPosts
-
October 4, 2015 at 9:53 pm #513388
Hi!
I’m using Woocommerce Product Filter plugin, everything works fine with the theme, just there’s one thing that keeps like “pending” for being fully integrated. I need to configure the config.php file inside config-woocommerce folder, but is there any way to make this permanent? (Like using a code in functions.php to avoid being override everytime when Enfold is updated, or load addtional code from the config.php in the Child theme folder).
Thank you.
PS. So to have the complete information (maybe it can give you some background) to the plugin to work I need to do the next things:
To insert the Product Filter template locate the avia_woocommerce_before_shop_loop() function. After the main wrapper insert the Product Filter action. The function should then look something like this
add_action( 'woocommerce_before_shop_loop', 'avia_woocommerce_before_shop_loop', 1); function avia_woocommerce_before_shop_loop() { global $avia_config; if(isset($avia_config['dynamic_template'])) return; $markup = avia_markup_helper(array('context' => 'content','echo'=>false,'post_type'=>'products')); echo "<main class='template-shop content ".avia_layout_class( 'content' , false)." units' $markup><div class='entry-content-wrapper'>"; do_action('prdctfltr_output'); /* This is the part you should add to initiate the Product Filter in your Enfold template */ }
Now, in order to disable the deafult Enfold product filter you should locate the avia_woocommerce_frontend_search_params() function and remove the action for inserting this bit of code. The first lines of this function should look like this
if(!function_exists('avia_woocommerce_frontend_search_params')) { //add_action( 'woocommerce_before_shop_loop', 'avia_woocommerce_frontend_search_params', 20); function avia_woocommerce_frontend_search_params() {
The two // chars comment the line and the action for inserting the Enfold product filter. Now save your file and the filter will be available on your shop and product archive pages.
October 5, 2015 at 11:45 am #513626Hi C-LabMX!
Thank you for using Enfold.
You can try this in the functions.php file:
remove_action( 'woocommerce_before_shop_loop', 'avia_woocommerce_before_shop_loop', 1); remove_action( 'woocommerce_before_shop_loop', 'avia_woocommerce_frontend_search_params', 20); add_action( 'woocommerce_before_shop_loop', 'avia_woocommerce_before_shop_loop_mod', 1); function avia_woocommerce_before_shop_loop_mod() { global $avia_config; if(isset($avia_config['dynamic_template'])) return; $markup = avia_markup_helper(array('context' => 'content','echo'=>false,'post_type'=>'products')); echo "<main class='template-shop content ".avia_layout_class( 'content' , false)." units' $markup><div class='entry-content-wrapper'>"; do_action('prdctfltr_output'); /* This is the part you should add to initiate the Product Filter in your Enfold template */ }
Cheers!
IsmaelOctober 6, 2015 at 2:18 am #514107Hi Ismael!
Thank you! Just one little thing, with that code the footer had some changes in color, for example the titles went gray, the links blue, and white line appeared. This just happens in the pages where the product filter is visible.
Using the code directly in the config.php didn’t had this effect.
Any ideas?
October 6, 2015 at 10:47 am #514274Hey!
Did you remove the previous modifications after adding the code? It doesn’t affect the footer on my installation.
Best regards,
IsmaelOctober 6, 2015 at 4:07 pm #514494Hi Ismael!
Yes, that was the first thing I did. Already tried erasing the cache without success and visiting the site from Incognito mode. You see correctly the links? (In white color)
October 7, 2015 at 8:49 am #514994Hi!
What happens when you remove this line of code?
do_action('prdctfltr_output'); /* This is the part you should add to initiate the Product Filter in your Enfold template */
I know it will remove the new filter. Is the footer OK when you remove that line?
Cheers!
IsmaelOctober 11, 2015 at 8:55 pm #517027Hi Ismael!
The footer keeps the same when removing that line, sorry for the delay.
Any ideas?
PS. Removing the whole function avia_woocommerce_before_shop_loop_mod() the footer returned to its usual design.
- This reply was modified 9 years, 1 month ago by odmv.
October 20, 2015 at 8:44 am #521438Hey!
Sorry for the delay. Please try to replace the code with this:
remove_action( 'woocommerce_before_shop_loop', 'avia_woocommerce_before_shop_loop', 1); remove_action( 'woocommerce_before_shop_loop', 'avia_woocommerce_frontend_search_params', 20); remove_action( 'woocommerce_after_shop_loop', 'avia_woocommerce_after_shop_loop', 10); add_action( 'woocommerce_before_shop_loop', 'avia_woocommerce_before_shop_loop_mod', 1); function avia_woocommerce_before_shop_loop_mod() { global $avia_config; if(isset($avia_config['dynamic_template'])) return; $markup = avia_markup_helper(array('context' => 'content','echo'=>false,'post_type'=>'products')); echo "<main class='template-shop content ".avia_layout_class( 'content' , false)." units' $markup><div class='entry-content-wrapper'>"; do_action('prdctfltr_output'); /* This is the part you should add to initiate the Product Filter in your Enfold template */ } # # closes the avia framework content container arround the shop loop # add_action( 'woocommerce_before_shop_loop', 'avia_woocommerce_after_shop_loop_mod', 1); function avia_woocommerce_after_shop_loop_mod() { global $avia_config; if(isset($avia_config['dynamic_template'])) return; if(isset($avia_config['overview'] )) echo avia_pagination('', 'nav'); echo "</main>"; //end content }
Regards,
IsmaelOctober 21, 2015 at 9:33 am #522201Thank you Ismael! Just made two small changes and now works great (the default filter wasn’t hidding for a strange reason and there was an extra pagination at the top).
-
AuthorPosts
- The topic ‘Child theme’ is closed to new replies.