Viewing 1 replies (of 1 total)
  • Plugin Author Sunny Johal

    (@sunny_johal)

    Hi Fernando,
    I wouldn’t recommend editing the plugin code as this means that you would not be able to upgrade to future versions of this plugin. Try inserting the following code in your themes functions.php file:

    function fernando_ecs_admin_footer_script() {
        $screen = get_current_screen();
    
        // Bail if this is not easy custom
        // sidebars admin page.
        if ( 'appearance_page_easy-custom-sidebars' != $screen->id ) {
            return;
        }
        ?>
        <script type='text/javascript'>
            ;( function( $, window, document, undefined ) { "use strict";
                $(document).on( 'ready', function() {
                    $( '#sidebar-all-pages-column' ).on( 'change', '.menu-item-checkbox', function() {
                        var checkbox = $(this);
                        var value    = checkbox.attr( 'value' );
                        var children = checkbox.parent().siblings( 'ul.children' ).find( '.menu-item-checkbox' );
    
                        if ( checkbox.prop( 'checked' ) ) {
                            children.attr( 'checked', true );
                        } else {
                            children.attr( 'checked', false );
                        }
    
                    });
                });
            }( jQuery, window, document ) );
        </script>
        <?php
    }
    add_action( 'admin_print_scripts', 'fernando_ecs_admin_footer_script', 99 );

    Let me know how you get on. Cheers

    Sunny

Viewing 1 replies (of 1 total)
  • The topic ‘Showing a sidebar on subcategories of a cheked category’ is closed to new replies.