• Resolved vchad14

    (@vchad14)


    hello.

    At first thank you for the plugin, it’s awesome!

    Can you tell me, how can I identify the sidebar name or id which is chosen on current page?

    Everything works fine, if I choose other sidebar, but if I choose empty sidebar (first option of the select box) I want not to show the sidebar, but wordpress default shows primary sidebar.

    I’m trying to get the name or id of selected custom sidebar and then php

    <?php
    if (!empty( chosen_custom_sidebar() )) {
    get_sidebar();
    }
    ?>

    can you help?

    thanks!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello @vchad14,

    let me check this with developer if he can give us some feedback here. As soon I will know more I will get back to you.

    kind regards,
    Kasia

    Sorry for the long delay. I finally got some feedback. You can use this code to get the ID.

    global $post;
    
    $csidebars = CustomSidebars::get_replacements($post->ID);
    var_dump($csidebars);

    returns:

    array(1) {
    [“sidebar-1”]=>
    string(4) “cs-1”
    }

    I hope that helps!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to detect if sidebar is chosen’ is closed to new replies.