admin管理员组文章数量:1402086
Hey WordPress friends,
I’m using the Disqus comment system plugin, which is working fine. My homepage is just a collection if recent posts and therefore not having the option to leave a comment (as desired).
Unfortunately, I still see that the Disqus plugin is rendering JavaScript output within the homepage and would like to get rid of this.
I've Tried the following but without luck. Any help is appreciated! Thanks
function block_disqus_count() {
if ( is_front_page())
remove_filter('output_count_js', 'dsq_output_count_js');
}
add_action( 'block_disqus_count' , 'block_disqus_count');
Hey WordPress friends,
I’m using the Disqus comment system plugin, which is working fine. My homepage is just a collection if recent posts and therefore not having the option to leave a comment (as desired).
Unfortunately, I still see that the Disqus plugin is rendering JavaScript output within the homepage and would like to get rid of this.
I've Tried the following but without luck. Any help is appreciated! Thanks
function block_disqus_count() {
if ( is_front_page())
remove_filter('output_count_js', 'dsq_output_count_js');
}
add_action( 'block_disqus_count' , 'block_disqus_count');
Share
Improve this question
asked Jul 22, 2016 at 3:10
Kevin BronsdijkKevin Bronsdijk
1
3
- 1 Plugins are off-topic here... lo ciento mi amigo. – jgraup Commented Jul 22, 2016 at 4:07
- Hi Kevin, welcome to WPSE. As @jgraup says - you'll need to ask this at the Disqus forums, sorry! – Tim Malone Commented Jul 22, 2016 at 4:53
- That's fine. It can be seen as a general WP programming question. I 'm just trying to overwrite / suppress the call of a plugin, which isn't working. – Kevin Bronsdijk Commented Jul 22, 2016 at 4:55
2 Answers
Reset to default 1You should deregister it. Add this function into your functions.php:
add_action( 'wp_enqueue_scripts', 'disqus_scripts' );
function disqus_scripts() {
if(is_front_page()) {
wp_deregister_script('disqus_count');
}
}
Solved it by altering the file disqus.php. First find function
function dsq_output_count_js() {
Add the following check before the function tries to output the JS
if ( ! is_front_page() ) { ?> <script type="text/javascript">
I’m using this until Disqus created the option to configure this. Thanks for the help.
本文标签: functionsRemove Disqus JavaScript from homepage
版权声明:本文标题:functions - Remove Disqus JavaScript from homepage 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744345995a2601762.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论