One Click Close Comments

Beskrivning

From the admin listing of posts (’Edit Posts’) and pages (’Edit Pages’), a user can close or open comments to any posts to which they have sufficient privileges to make such changes (essentially admins and post authors for their own posts). This is done via an AJAX-powered color-coded indicator. The color-coding gives instant feedback on the current status of the post for comments: green means the post/page is open to comments, red means the post/page is closed to comments. Being AJAX-powered means that the change is submitted in the background after being clicked without requiring a page reload.

This plugin will only function for administrative users in the admin who have JavaScript enabled.

Links: Plugin Homepage | Plugin Directory Page | GitHub | Author Homepage

Hooks

The plugin exposes one filter for hooking. Such code should ideally be put into a mu-plugin or site-specific plugin (which is beyond the scope of this readme to explain).

c2c_one_click_close_comments_click_char (filter)

The ’c2c_one_click_close_comments_click_char’ hook allows you to use an alternative character, string, or markup as the plugin’s indicator in the posts listing tables. It is the character that gets color-coded to indicate if comments are open or close, and the thing to click to toggle the comment open status. You can make use of Dashicons by specifying the desired dashicon’s name (with the ”dashicons-” prefix). By default this is the comments dashicon, dashicons-admin-comments.

Arguments:

  • $char (array): The character, string, or markup to be used for display (by default this is dashicons-admin-comments).

Example:

/**
 * Changes the character used as the one-click link to a bullet (solid circle).
 *
 * @param string $char The default character.
 * @return string
 */
function custom_one_click_char( $char ) {
    return '•';
}
add_filter( 'c2c_one_click_close_comments_click_char', 'custom_one_click_char' );

Skärmdumpar

  • A screenshot of the 'Posts' admin page with the plugin activated. The tooltip (from hovering over a green indicator) reads: "Comments are open. Click to close." Were the mouse to hover over a red indicator, the tooltip would read: "Comments are closed. Click to open."

Installation

  1. Install via the built-in WordPress plugin installer. Or download and unzip one-click-close-comments.zip inside the plugins directory for your site (typically wp-content/plugins/)
  2. Activate the plugin through the ’Plugins’ admin menu in WordPress
  3. When on the ’Edit Posts’ or ’Edit Pages’ admin pages, click the indicators to toggle the comment status for a post, as necessary.

Vanliga frågor

I can see the colored comment bubble indicating current commenting status, but why aren’t they clickable?

The commenting status link/button is only clickable is you have JavaScript enabled.

What does the color-coding of the comment bubble mean?

Green means the post is currently open for comments; red means the post is not currently open for comments.

How can I customize the color-coding used for the comment bubble?

You can customize the colors via CSS. .comment-state-1 indicates comments are open. .comment-state-0 indicates comments are closed.

How can I customize the character used to represent commenting status?

By default, commenting status is represented using the comment bubble dashicon, dashicons-admin-comments. You can change this by filtering c2c_one_click_close_comments_click_char. Here’s an example — added to a theme’s functions.php file — to change it to the original bullet
(solid circle) character:

add_filter( 'c2c_one_click_close_comments_click_char', function ( $a ) { return "•"; } );

Recensioner

19 juni, 2018
Excellent plugin. Used it for many years without a problem. It is a pity that it is not updated anymore.
3 september, 2016
However the dot is green even though the comments were automatically closed. Why? Error or feature? 🙂
Läs alla 8 betyg

Bidragsgivare och utvecklare

”One Click Close Comments” är programvara med öppen källkod. Följande personer har bidragit till detta tillägg.

Bidragande personer

”One Click Close Comments” har översatts till 3 språk. Tack till översättarna för deras bidrag.

Översätt ”One Click Close Comments” till ditt språk.

Intresserad av programutveckling?

Läs programkoden, kika på SVN-filförvaret eller prenumerera på utvecklarloggen via RSS.

Ändringslogg

2.6 (2019-03-22)

  • New: Add support for using dashicons for the click character
  • Change: Replace the bullet character (solid circle) with comment bubble dashicon as column icon for one-click link
  • New: Add CHANGELOG.md file and move all but most recent changelog entries into it
  • New: Add inline documentation for hook
  • Change: Initialize plugin on ’plugins_loaded’ action instead of on load
  • Change: Use apply_filters_deprecated() when using the deprecated filter
  • Change: Use wp_doing_ajax() for official detection of use of AJAX
  • Change: Tweak plugin description
  • Change: Split paragraph in README.md’s ”Support” section into two
  • Change: Note compatibility through WP 5.1+
  • Change: Remove support for versions of WordPress older than 4.7
  • Change: Update copyright date (2019)
  • Change: Update License URI to be HTTPS
  • Change: Update screenshot, icon, and banner for Plugin Directory

2.5 (2018-08-03)

  • Change: Improve display of control toggle (and label) on smaller viewports
  • Change: Include plugin version number when registering styles
  • New: Add README.md
  • Change: Add explicit curly braces to JS ’if’ statement
  • Change: Add GitHub link to readme
  • Change: Note compatibility through WP 4.9+
  • Change: Update copyright date (2018)
  • Change: Rename readme.txt section from ’Filters’ to ’Hooks’
  • Change: Modify formatting of hook name in readme to prevent being uppercased when shown in the Plugin Directory

2.4 (2017-02-04)

  • Change: Improve accessbility (a11y)
    • Add descriptive text for close/open link to display instead of the indicator character for screen readers
    • Change colors to be WCAG AA compliant
  • Change: Use printf() to format output markup rather than concatenating strings, variables, and function calls.
  • Change: Escape variables used as markup attributes (hardening; none of the instances are user input).
  • Change: Note compatibility through WP 4.7+.
  • Change: Remove support for WordPress older than 4.6 (should still work for earlier versions back to WP 3.1)
  • Change: Minor code reformatting (add spacing between sections of code).
  • Change: Minor readme.txt improvements.
  • Change: Update copyright date (2017).
  • Change: Update screenshot.

Full changelog is available in CHANGELOG.md.