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 : 

9 sujets de 1 à 9 (sur un total de 9)
  • Auteur
    Messages
  • #821059
    ShadowHunter
    Participant

    Hello,

    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.

    cuar_persistant_sidebar

    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?

    cuar_sidebars

    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.

    1. WordPress version: 5.5.3
    2. WP Customer Area version: 7.10.3 {write here…}

    With best regards,

    ShadowHunter

    Pièces jointes:
    #821179
    ShadowHunter
    Participant

    Hello,

    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_file

    So 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

    #821371
    Vincent Mimoun-Prat
    Admin bbPress

    Hi,

    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 );
    
    #821419
    ShadowHunter
    Participant

    Hi Vincent,

    Thank you so much for this flexible approach, simply perfect 🙂

    With best regards,

    TheRealShadowHunter

    #821580
    Thomas Lartaud
    Admin bbPress

    Hi,

    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.

    #821590
    ShadowHunter
    Participant

    Hello 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

    #822230
    Thomas Lartaud
    Admin bbPress

    Hi,

    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.

    #822239
    ShadowHunter
    Participant

    Hi 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

    #822371
    Thomas Lartaud
    Admin bbPress

    You’re welcome.

    You can follow our plugin conflict guidelines for that.

    Regards

9 sujets de 1 à 9 (sur un total de 9)
  • Vous devez être connecté pour répondre à ce sujet.