Forked from joshuacharleslake/wordpress-disqus-shortcode.php
Created
April 5, 2020 18:25
-
-
Save JarrydLong/3cca46e927d1154a6269a22c011cca3d to your computer and use it in GitHub Desktop.
Add Shortcode for disqus embed.
This file contains 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
function disqus_embed($disqus_shortname) { | |
global $post; | |
wp_enqueue_script('disqus_embed','http://'.$disqus_shortname.'.disqus.com/embed.js'); | |
echo '<div id="disqus_thread"></div> | |
<script type="text/javascript"> | |
var disqus_shortname = "'.$disqus_shortname.'"; | |
var disqus_title = "'.$post->post_title.'"; | |
var disqus_url = "'.get_permalink($post->ID).'"; | |
var disqus_identifier = "'.$disqus_shortname.'-'.$post->ID.'"; | |
</script>'; | |
} | |
<?php disqus_embed('THE SHORTNAME OF YOUR DISQUS'); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment