Last active
August 29, 2015 14:21
-
-
Save neltseng/bf378d47696b387cf382 to your computer and use it in GitHub Desktop.
新增 Disqus tab
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('woocommerce_product_tabs', 'cwp_woo_disqus_tab'); | |
function cwp_woo_disqus_tab($tabs) { | |
$tabs['disqus_tab'] = array('title' => __('留言') , 'priority' => 50, 'callback' => 'cwp_woo_disqus_tab_content'); | |
return $tabs; | |
} | |
function cwp_woo_disqus_tab_content() { | |
echo '<div id="disqus_thread"></div> | |
<script type="text/javascript"> | |
var disqus_shortname = "Your_Disqus_Shortcode"; // 替換你的 Disqus 名稱 | |
(function() { | |
var dsq = document.createElement("script"); dsq.type = "text/javascript"; dsq.async = true; | |
dsq.src = "//" + disqus_shortname + ".disqus.com/embed.js"; | |
(document.getElementsByTagName("head")[0] || document.getElementsByTagName("body")[0]).appendChild(dsq);})(); | |
</script> | |
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment