Created
August 21, 2024 18:32
-
-
Save rachelslurs/cc36b9810c0f04b12522942c99334ffd to your computer and use it in GitHub Desktop.
Add Cusdis Comments Shortcode to Static Wordpress Site
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
/** | |
* Make sure to replace your APP_ID with the value from your hosted Cusdis instance. | |
* You can grab it from your embed code or from your URL https://cusdis.com/dashboard/project/{{ APP_ID }} | |
*/ | |
function cusdis_comments_shortcode() | |
{ | |
$page_id = get_the_ID(); | |
$page_url = get_permalink($page_id); | |
$page_title = get_the_title($page_id); | |
return '<div id="cusdis_thread" | |
data-host="https://cusdis.com" | |
data-app-id="{{ APP_ID }}" | |
data-page-id="' . $page_id . '" | |
data-page-url="' . $page_url . '" | |
data-page-title="' . $page_title . '" | |
></div> | |
<script async defer src="https://cusdis.com/js/cusdis.es.js"></script> | |
'; | |
} | |
add_shortcode('cusdis', 'cusdis_comments_shortcode'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment