Skip to content

Instantly share code, notes, and snippets.

@rachelslurs
Created August 21, 2024 18:32
Show Gist options
  • Save rachelslurs/cc36b9810c0f04b12522942c99334ffd to your computer and use it in GitHub Desktop.
Save rachelslurs/cc36b9810c0f04b12522942c99334ffd to your computer and use it in GitHub Desktop.
Add Cusdis Comments Shortcode to Static Wordpress Site
/**
* 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