admin管理员组文章数量:1130349
Is it possible to remove a specific button from the page only if it is viewed from the Customizer? I did try a check for wp-customizer in body, but this only checks the body of the iframe and not the main window.
So, any idea how to do this with jQuery?
Is it possible to remove a specific button from the page only if it is viewed from the Customizer? I did try a check for wp-customizer in body, but this only checks the body of the iframe and not the main window.
So, any idea how to do this with jQuery?
Share Improve this question edited Nov 29, 2018 at 12:31 joq3 asked Nov 29, 2018 at 10:35 joq3joq3 3813 silver badges21 bronze badges 01 Answer
Reset to default 0You did not wrote if you want to check it using PHP or JavaScript but if using PHP you can add to your theme a below function it will return true if the page is previewed using Customizer
function is_customizer_preview() {
if( isset( $_GET['customize_theme'] ) ) {
return true;
} else {
return false;
}
}
Then somewhere in the theme template files you can use it like that if you want to have an additional class in the body
<body class="some-classes <?php if(is_customizer_preview()): ?>my-customizer-class<?php endif; ?>">
Is it possible to remove a specific button from the page only if it is viewed from the Customizer? I did try a check for wp-customizer in body, but this only checks the body of the iframe and not the main window.
So, any idea how to do this with jQuery?
Is it possible to remove a specific button from the page only if it is viewed from the Customizer? I did try a check for wp-customizer in body, but this only checks the body of the iframe and not the main window.
So, any idea how to do this with jQuery?
Share Improve this question edited Nov 29, 2018 at 12:31 joq3 asked Nov 29, 2018 at 10:35 joq3joq3 3813 silver badges21 bronze badges 01 Answer
Reset to default 0You did not wrote if you want to check it using PHP or JavaScript but if using PHP you can add to your theme a below function it will return true if the page is previewed using Customizer
function is_customizer_preview() {
if( isset( $_GET['customize_theme'] ) ) {
return true;
} else {
return false;
}
}
Then somewhere in the theme template files you can use it like that if you want to have an additional class in the body
<body class="some-classes <?php if(is_customizer_preview()): ?>my-customizer-class<?php endif; ?>">
本文标签: jqueryRemove button from page if viewed through Customizer
版权声明:本文标题:jquery - Remove button from page if viewed through Customizer 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749141945a2322320.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论