PHPackages                             samharrison/disqus-plugin - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. samharrison/disqus-plugin

ActiveStreams-addon[Utility &amp; Helpers](/categories/utility)

samharrison/disqus-plugin
=========================

A simple plugin to display Disqus comments.

v1.0.1(9y ago)217MITPHP

Since Dec 12Pushed 9y ago2 watchersCompare

[ Source](https://github.com/samharrison7/disqus-plugin)[ Packagist](https://packagist.org/packages/samharrison/disqus-plugin)[ RSS](/packages/samharrison-disqus-plugin/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (3)Used By (0)

Disqus Plugin for PyroCMS
=========================

[](#disqus-plugin-for-pyrocms)

This plugin provides a simple way to display Disqus comments on pages, posts or pretty much wherever you want.

Installation
------------

[](#installation)

Simply copy the plugin's files to `addons/{site-ref}/samharrison/disqus-plugin` (or ask your administrator if you don't have access to your site's files).

Alternative, you can use Composer:

```
composer require samharrison/disqus-plugin

```

Setup
-----

[](#setup)

Firstly, make sure you've registered your website with Disqus. Check out their [Quickstart Guide](https://help.disqus.com/customer/portal/articles/466182-quick-start-guide) for more information.

Whilst registering, you'll be able to specify a "forum shortname" for your website. Before using the plugin, you must set this shortname in the Plugin section of the Settings module. If you don't set a shortname, the Disqus comments won't load.

Usage
-----

[](#usage)

The simplest way to display comments is to add

```
{{ disqus() }}

```

to a template (e.g., you theme's layout files, or a post/page type's layout field). Disqus takes the page's unique identifier as being the page URL and the title as being whatever is in the `title` attribute. However, it is recommended to define your own unique identifier as using a URL can be unreliable (e.g., if you change domains or the page's slug). You can do so by providing it as a parameter for the plugin. For example, if you are using the plugin on a post's template:

```
{{ disqus(post.id) }}

```

Or, on a page's template:

```
{{ disqus(page.id) }}

```

*Warning:* Posts and pages (and other entries you wish to display comments on) might share the same ID, so if you wish to display comments on them all, it might be wise to prefix the identifier; for example, `{{ disqus('posts-'~post.id) }}`. You can also prevent Disqus using the `` attribute by specifying a title as the second parameter:

```
{{ disqus(
    post.id,
    post.title
}}

```

More on Disqus' configuration variable can be found in the [Disqus documentation](https://help.disqus.com/customer/portal/articles/472098-javascript-configuration-variables).

### Output the Javascript only

[](#output-the-javascript-only)

To display comments, a `` with `id="disqus_thread"` is required where the comments should be displayed on the page. The `{{ disqus() }}` plugin above includes this wherever in the template it is used. If you wish to output only the Javascript so that you have more control over where and how the `` is display, you can use the `{{ disqus_script() }}` plugin.

For example, this might be useful is you want to add custom classes to the ``, or to place it in a template where it isn't so easy to get the page or post's ID:

```

{{ disqus_script() }}

```

`disqus_script()` supports the same options as `disqus()`.

Use case: Post comments that can be disabled
--------------------------------------------

[](#use-case-post-comments-that-can-be-disabled)

This plugin makes adding Disqus comments to a post super easy, even if you don't have access to your site's theme files. Here's an example of how to add Disqus comments to a post, with an option on each post as to whether you want the comments displayed or not.

Firstly, install the plugin as above and ensure you've set your forum shortname in the Settings module. Now, let's create a boolean (true/false) field type by going to the Field section in the Posts module, adding a new field and selecting "Boolean" as the field type:

[![add_field](https://cloud.githubusercontent.com/assets/3359948/21137512/afe834cc-c121-11e6-948e-42ff534c9ea4.png)](https://cloud.githubusercontent.com/assets/3359948/21137512/afe834cc-c121-11e6-948e-42ff534c9ea4.png)

Name the field whatever you like (e.g., "Display Disqus comments?") and set the slug to "enable\_disqus". Now assign this field to a particular page type in the Types section of the Posts module, by selecting "Assignments" on the page type you want (e.g., Default) and then "Assign Fields". Select the field you just created by the name you gave it, and fill in any details you wish on the field assignment form.

Now we can edit the page type's layout to show the Disqus comments: Select the "Edit" button of the page type you've just assigned the new field to, and add the following code to the bottom of the Post Layout field:

```
{% if post.enable_disqus %}
    {{ disqus(post.id) }}
{% endif %}

```

Depending on how your site is set up, the Post Layout might now look something like this:

[![post_layout](https://cloud.githubusercontent.com/assets/3359948/21154989/48326f22-c168-11e6-818b-0d9b508f433a.png)](https://cloud.githubusercontent.com/assets/3359948/21154989/48326f22-c168-11e6-818b-0d9b508f433a.png)

When you create a new post of this type, you can now select if you want Disqus comments to be displayed or not, and if you opt to display them, the comments will be embedded at the bottom of your blog post:

[![post](https://cloud.githubusercontent.com/assets/3359948/21137509/afe2a4ee-c121-11e6-820b-629951ebadbc.png)](https://cloud.githubusercontent.com/assets/3359948/21137509/afe2a4ee-c121-11e6-820b-629951ebadbc.png)

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

3486d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3359948?v=4)[Sam Harrison](/maintainers/samharrison7)[@samharrison7](https://github.com/samharrison7)

---

Top Contributors

[![samharrison7](https://avatars.githubusercontent.com/u/3359948?v=4)](https://github.com/samharrison7 "samharrison7 (13 commits)")

---

Tags

disqusstreams plugin

### Embed Badge

![Health badge](/badges/samharrison-disqus-plugin/health.svg)

```
[![Health](https://phpackages.com/badges/samharrison-disqus-plugin/health.svg)](https://phpackages.com/packages/samharrison-disqus-plugin)
```

###  Alternatives

[kartik-v/yii2-social

Module containing useful widgets for Yii Framework 2.0 that integrates social functionalities from DISQUS, Facebook, Google etc.

91261.4k8](/packages/kartik-v-yii2-social)[yajra/laravel-disqus

A simple Disqus platform integration with Laravel.

8457.3k](/packages/yajra-laravel-disqus)[knplabs/knp-disqus-bundle

6280.6k](/packages/knplabs-knp-disqus-bundle)[nystudio107/craft-disqus

Integrates the Disqus commenting system into Craft CMS websites, including Single Sign On (SSO) and custom login/logout URLs

1318.5k](/packages/nystudio107-craft-disqus)[nikolaposa/zf-disqus

ZF module which facilitates integration of Disqus widgets

1210.7k](/packages/nikolaposa-zf-disqus)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
