Yet another sidebars can’t be hidden… but with a twist
Accueil › Forums › Main plugin support › Yet another sidebars can’t be hidden… but with a twist
Mots-clés : sidebar
- Ce sujet contient 8 réponses, 3 participants et a été mis à jour pour la dernière fois par
Thomas Lartaud, le il y a 2 mois et 1 semaine.
-
AuteurMessages
-
November 15, 2020 à 2:23 pm #821059
ShadowHunter
ParticipantHello,
First of all thank you for this fantastic plugin, it is exactly what I’m looking for. Except for this one little issue of not being able to hide the sidebar when showing a single page or file.
I’m using OceanWP, the default layout is set to display no sidebars at all. This works okay except for the aforementioned actual private pages or files.
I have search and tried everthing that I could find on the forum and support pages (for example copy and rename page.php to cuar.php) – I do understand that this is probably a theme issue but hope you can support my next question:
You can see in CUAR > Status > Pages following two have still sidebar, how to remove these?
The only thing that makes the sidebars dissapear is by adding this snipped to my theme functions.php:
function my_post_layout_class( $class ) { // Alter your layout if ( is_singular( '' ) ) { $class = 'full-width'; } // Return correct class return $class; } add_filter( 'ocean_post_layout_class', 'my_post_layout_class', 20 );
However, my final goal is to have normal single post (regular post type) to have a side bar but the content displayed by CustomerArea to be full width.
I think this can be accomplished with the above snippet but I wonder what “is_singular” parameter (I supose it will be a CPT name) I need to use in order to filter correctly and to affect only the actual private pages and files?
Thank you so much for reaching out a helping hand. I’m confident a solution can be found.
- WordPress version: 5.5.3
- WP Customer Area version: 7.10.3 {write here…}
With best regards,
ShadowHunter
Pièces jointes:
Vous devez être connecté pour accéder aux fichiers joints.
November 15, 2020 à 9:46 pm #821179ShadowHunter
ParticipantHello,
Found a solution, hope it can help others strugeling with the same issue.
I ran following query to find the CPT’s used by CUAR:
{SELECT DISTINCT( post_type ) FROM wp_posts;}
And following candidates showed up:
- cuar_private_page
cuar_private_fileSo put the below code in functions.php of my theme:
{function my_post_layout_class( $class ) { // Alter your layout if ( is_singular( array('cuar_private_page','cuar_private_file') ) ) { $class = 'full-width'; } // Return correct class return $class; } add_filter( 'ocean_post_layout_class', 'my_post_layout_class', 20 );}
And it worked perfect. Now sidebars are gone.
I also had problems with the menu’s (the well known bootstrap issue) this could be fixed by adding following code to a custom HTML widget placed in the footer.
{<script type="text/javascript"> jQuery(document).ready(function ($) { $('body.customer-area .dropdown-toggle').click(function(){ $(this).parent().toggleClass('open'); }); }); </script>}
With best regards,
ShadowHunter
November 16, 2020 à 10:51 am #821371Vincent Mimoun-Prat
Admin bbPressHi,
If you want something which will work will all addons too, you can use that test instead:
function my_post_layout_class($class) { $cuar_plugin = cuar(); $private_types = $cuar_plugin->get_private_post_types(); if (is_singular($private_types)) { $class = 'full-width'; } return $class; } add_filter( 'ocean_post_layout_class', 'my_post_layout_class', 20 );
Have a nice day!
November 16, 2020 à 11:58 am #821419ShadowHunter
ParticipantHi Vincent,
Thank you so much for this flexible approach, simply perfect 🙂
With best regards,
TheRealShadowHunter
November 16, 2020 à 3:17 pm #821580Thomas Lartaud
Admin bbPressHi,
Your bootstrap workaround will probably work but it’s not a fix.
You have probably many BS scripts loaded. If yes, some of them need to be dequeued in order to keep only one BS library.Regards.
November 16, 2020 à 3:33 pm #821590ShadowHunter
ParticipantHello Thomas,
Thank you for your feedback.
I know it is just a simple workaround but the thing is that as far a as I know OceanWP is not using bootstrap, maybe another plugin is loading it but so far I was not able to locate where.
Perhaps can point me in the right direction of finding where the bootstrap might be loaded?
Again, thank you for the excellent support.
With best regards,
TheRealShadowHunter
November 17, 2020 à 1:56 pm #822230Thomas Lartaud
Admin bbPressHi,
Perhaps can point me in the right direction of finding where the bootstrap might be loaded?
I don’t know. I don’t own this theme, sorry.
It can also be a JS script on your theme that incorrectly binds some JS actions into the plugin’s menus.
You can paste some temporary credentials in a private reply and I’ll check if I see something wrong.
Regards.
November 17, 2020 à 2:05 pm #822239ShadowHunter
ParticipantHi Thomas,
Thank you for following-up, much appreciated.
It is very likely that another plugin is interfering… I have alas quite some in use. I’m gonna first disable a bunch in order to narrow it down. I’ll be in touch after that.
Again, thank you for offering your support, simply fantastic.
With best regards,
TheRealShadowHunter
November 17, 2020 à 4:57 pm #822371Thomas Lartaud
Admin bbPress -
AuteurMessages
- Vous devez être connecté pour répondre à ce sujet.