Conflict with WP Customer Area plugin
-
Hello, I need a private area in wy website for logged members only, and after searching for plugins I found “Wp Customer area plugin”. It is what I was lookin for but the problem is that apparently there is a js conflict because they use boostrat as framework as well, and their dropdwons menus stop working. So after looking for a solutiion in their forums I found this:
If your dropdown menus are not working, or if you notice something displaying not correctly, (…)This conflict comes from Bootstrap javascript files loaded twice. To fix that conflict, you will need to either disable all Bootstrap JS loaded by your theme, or disable those loaded by WP Customer Area. The best practice for you would be to disable the Bootstrap loaded by your theme when we are displaying a WP Customer Area page. To do that, you need to browse the PHP files from your theme (start by looking into functions.php), and find where Bootstrap JS files are loaded. It should look like this:
wp_enqueue_script(‘bootstrap-scripts’);
Note that the name given to the styles or scripts can depend from your theme or plugin (bootstrap-scripts is just an example slug that your theme could use, you need to find the right one !).Once you have found this, add the following function to the bottom of your functions.php file (preferably inside a child theme):
function fix_cuar_and_theme_bootstrap_conflict(){
if (function_exists(‘cuar_is_customer_area_page’)
&& (cuar_is_customer_area_page(get_queried_object_id())
|| cuar_is_customer_area_private_content(get_the_ID())))
{
wp_dequeue_script(‘bootstrap-scripts’);
}
}
add_action(‘wp_enqueue_scripts’, ‘fix_cuar_and_theme_bootstrap_conflict’, 20);Do not forget to replace the slug bootstrap-scripts by the one you found in your theme or it won’t fix anything.
This is the link: https://wp-customerarea.com/documentation/resolving-bootstrap-conflicts/
Would you please help me finding the piece of code they’re refferring? I can’t find it… Or is there any other solution for my issue?
Thank you in adnvance and my apologies for the long message.
-
Hey,
Thanks for posting,I have a quick fix for you, go to your appearance > widgets page and add a custom html widget into one of the footer widget areas.
Place this into that widget area:
<script type="text/javascript"> jQuery(document).ready(function ($) { $('body.customer-area .dropdown-toggle').click(function(){ $(this).parent().toggleClass('open'); }); }); </script>
That should resolve the issue.
Let me know.
Ben
Thank you @britner, I was trying a different plugin, but I’ll install again Wp Customer Area Plugin and try your code!
Hi again @britner , I have tested your piece of code but, unfortunately, it is not working for me. Everything works except for the dropdown menus in user dashboard.
Hmm, I tested this with that plugin and it worked, would it be possible for you to send me a link and so I can see why that isn’t working on your page?
Ben
Hi @britner, of course, this is the website:
http://epe-apv.com/ But, you’ll need the credentials, I guess. Tell me and I’ll send them to you.
Thanks again,Leire
- This reply was modified 5 years, 2 months ago by leirelo.
Can you create a guest account that has just access to the page?
Right now I don’t see the script I posted in your footer widgets.
Hi @britner I’ve checked it again and I’ve seen strange characters in the piece of code I had pasted, so I’ve fixed it and now it’s working perfectly!
Thanks again,Leire
Sounds like maybe you copied the code from an email and not from the forum. Be sure that you’re always copying directly from the forum since email clients will sanitize the code.
-Kevin
This was for sure what happened! I’ll keep in mind, thanks @jx-3p
Thank you everybody
- The topic ‘Conflict with WP Customer Area plugin’ is closed to new replies.