{"id":7284753,"date":"2016-04-16T13:46:19","date_gmt":"2016-04-16T13:46:19","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/customizer-content-specific-controls\/"},"modified":"2016-08-31T15:58:27","modified_gmt":"2016-08-31T15:58:27","slug":"customizer-content-specific-controls","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/customizer-content-specific-controls\/","title":{"rendered":"Customizer content specific controls"},"content":{"rendered":"<p>Hi, i&#8217;m struggeling with one challenge to do in my custom theme. I want to have content specific controls in my Theme Customizer. I know there is option &#8220;active_callback&#8221;, but this is not sufficient for my purpose and i read 2 documentation articles about customizer and this https:\/\/make.wordpress.org\/core\/2014\/07\/08\/customizer-improvements-in-4-0\/ article, but still have no clue, here is what i want to achieve:<\/p>\n<p>For example, i want to have &#8220;show sidebar&#8221; checkbox, but this checkbox should be more contextual specifix. For example, when i will be on homepage, there will be just one checkbox as &#8220;Show sidebar default&#8221; but when i will go into some post, i want there 3 checkboxes:<\/p>\n<p>1. &#8220;Show sidebar default&#8221; &#8211; id=&#8221;show_sidebar&#8221;<br \/>\n2. &#8220;Show sidebar in Post archive page&#8221; &#8211; id=&#8221;show_sidebar_archive_{post_type}&#8221;<br \/>\n3. &#8220;Show sidebar for this post&#8221; &#8211; id=&#8221;show_sidebar_singular_{post_id}&#8221;<\/p>\n<p>So when i want to have this kind of specific IDs for control, just active_callback is not enought, becauce it can just show\/hide controls, i can&#8217;t create new when URL in iframe changes. <\/p>\n<p>There could be 2 sollutions:<br \/>\n1. Better &#8211; when i could somehow create\/remove controls by context, it would be best solution. If it&#8217;s somehow possible with customizer API, give me som hint please<br \/>\n2. Not good, but sufficient &#8211; is at least possible somehow reload whole \/wp-admin\/customize.php?url= with new clicked url? this could be enought for a while<\/p>\n<p>thx for any advices!<\/p>\n","protected":false},"template":"","class_list":["post-7284753","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/7284753","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/7284753\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=7284753"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}