Decent Comments Manual

Decent Comments Widget Configuration

To use a Decent Comments comment widget on your site, go to Appearance > Widgets and drag a Decent Comments to the desired sidebar. If you don’t want to customize the widget’s settings, you’re done.

You can use as many Decent Comments widgets you want, each with different settings.

For each widget, these options are available:

  • Title : If desired, give your widget a title that will appear above the comments.
  • Number of comments : Determines how many comments will be shown.
  • Order by … : Choose the criterion used to sort comments.
  • Sort order : Based on the criterion, comments can be shown in ascending or descending order.
  • Post ID : If empty, shows comments from anywhere on your site, based on the criterion chosen. You can enter part of the title of a post or a post’s ID to only show comments related to a specific post. You can enter [current] or {current} to show comments for the post that is currently displayed.
  • Show comment excerpt : If checked, shows excerpts of the comments. If unchecked, shows the full text of comments.
  • Number of words in excerpt : Determines up to how many words are shown as an excerpt for each comment.
  • Ellipsis : This is shown after a comment’s excerpt, if there are more words in the comment than shown in the excerpt.
  • Show author : If checked, displays the author of each comment.
  • Show avatar : If checked, displays the comment author’s avatar.
  • Avatar size : Determines the size of the avatars shown in pixels.
  • Show link to post : If checked, shows a link to the post that the comment is related to.
  • Show the comment : If checked, displays the comment excerpt or full comment.
  • Taxonomy : Indicate category if you would like to show comments on posts in certain categories. Give the desired categories’ slugs in Terms. For tags use post_tag and give the tags’ slugs in Terms.
  • Terms : If a taxonomy is given, indicate the slugs of the terms in that taxonomy separated by comma to show comments for all posts related to these terms. To show comments on posts related to the same terms as the current post, indicate: {current}. If a taxonomy is given and terms is empty, no comments will be shown.

Decent Comments Shortcodes

Decent Comments provides the [decent-comments/] shortcode that can be used to embed comments anywhere.

The shortcode can now also be written as [decent_comments/] (with an underscore instead of a dash).

If no attributes are given, the default settings are used.

Using default settings

Place the following shortcode anywhere to show comments based on the default settings:

[decent-comments/]

An example using customized settings

Place the following shortcode anywhere to show 25 comments featuring 64 pixel avatars:

[decent-comments number="25" avatar_size="64" /]

Shortcode attributes

The [decent-comments/] shortcode supports the following attributes:

ellipsis
Default : …

exclude_post_author
Default : false
Set to true if comments on posts from the post’s author should not be included.

excerpt
Default : true

max_excerpt_words
Default : 20

strip_tags
Default : true

avatar_size
Default : 24

number
Default : 5

order
Default : "DESC"
Possible values: "ASC", "DESC"

orderby
Default : "comment_date_gmt"
Possible values:
"comment_author_email" : Author Email
"comment_author_url" : Author URL
"comment_content" : Content
"comment_date_gmt" : Date
"comment_karma" : Karma
"comment_post_ID" : Post

post_id
Possible values:

  • "{current}" : show comments for the current post
    Usage: [decent_comments post_id="{current}"]
  • a post ID : show comments for a specific post
    For example: [decent_comments post_id="123"]

show_author
Default : true

show_avatar
Default : true

show_link
Default : true

show_comment
Default : true

taxonomy
Use category for categories or post_tag for tags.
Default : empty

terms
A comma-separated list of term slugs.
Default : empty

138 Responses to Decent Comments Manual

  1. Ramin March 5, 2016 at 11:41 am #

    Is it feasible to omit specific writers from display? I recognize I can omit the short articles author yet I wanted to omit various other users too.

    • antonio March 7, 2016 at 6:10 am #

      Hi Ramin,
      you can use the ‘comments_clauses’ filter to create your own filter, ex.
      add_filter( 'comments_clauses', 'eggemplo_comments_clauses', 10, 2 );
      function eggemplo_comments_clauses( $pieces, $dcomments ) {
      global $wpdb;
      if ( get_class( $dcomments ) == "Decent_Comment" ) {
      $users = "1,2,3,4";
      $pieces['where'] .= $wpdb->prepare( ' AND user_id NOT IN ("%s")', $users );
      }
      return $pieces;
      }

      Kind Regards,
      Antonio B.

  2. budditbud June 20, 2016 at 9:51 pm #

    i have a problem with accentuate caracters (éàè….) when i use excerpt they are not traduct (not UTF8 i suppose)

    you can add in french traduction

    excerpt : extrait
    Post Type : Type Article
    Number of characters in excerpts : Nombre de caractères dans les extraits
    Show date : Afficher la date
    Link authors : Lien Auteurs
    Exclude comments from post authors : Exclure les commentaires des articles des auteurs
    Ascending : Croissant
    Descending : Décroissant

    best regards
    ‘Pascal

    • antonio July 4, 2016 at 7:43 am #

      Hi budditbud,
      we’ll add them to the next update.
      Thank you very much,
      Antonio B.

  3. Steve Fleming September 5, 2016 at 12:57 am #

    Thanks for the plugin. I’m using it on my site and have set the strip_tags to false, but it still seems to be stripping out the formatting.

    Did I do something wrong?

    http://retiringtothephilippines.com/recent-comments/

    [decent-comments strip_tags="false" avatar_size="50" number="30" taxonomy="category" excerpt="false" /]

    • Kento September 6, 2016 at 8:17 am #

      Hi Steve,

      Many thanks for pointing out the issue with the strip_tags attribute. This has been fixed in version 1.3.10 which has been released just now. If you update it, you should find it working now.

      Cheers

      • Steve September 6, 2016 at 11:58 am #

        I tried the new update but I still don’t see any paragraph breaks etc. on that page.

        Does it work OK for you?

        Steve

        • antonio September 7, 2016 at 8:54 am #

          Hi Steve,
          Wordpress comments system doesn’t add paragraph automatically to the comments, so the <p> and <br/> tags don’t exist in the comment content.
          This is because these are nor displayed, but not dependent on the plugin, because these tags are not.
          If you edit the comment in the dashboard adding these tags you can see that they are not filtered.
          Kind Regards,
          Antonio B.

  4. Bahram September 24, 2016 at 2:24 pm #

    hi
    tanks for great plugin. i want to know how to display random comments by “decent comments” widget in sidebar?

    • antonio September 26, 2016 at 4:09 pm #

      Hi Bahram,
      this ‘order by’ option is not available.
      You could use the ‘the_comments’ hook to create your own pseudo-random solution.
      Kind Regards,
      Antonio B.

      • Bahram May 15, 2017 at 12:40 pm #

        Hi antonio
        Thank you for your response, if we do this from the ‘the_comments’ hook it will effect on all site comments? or only decent comment plugins?
        can you help me on this pls i am noob in wp and really need this.

        • antonio May 16, 2017 at 8:58 am #

          Hi Bahram,
          This filter affects all comments. But I have created a better solution. You need to add this code in your functions.php child theme file.
          Kind Regards,
          Antonio B.

  5. Bahram May 16, 2017 at 9:40 am #

    Hi Antonio
    it is very kind of you, i add it in function.php but nothing happens, i want to display some customers random comments in site homepage.
    address is http://www.javaherlux.com and i use decent comment in footer widgets.
    another thing is after adding this code to function.php, in decent comment widget “order by” switch should be on which option?

    • antonio May 16, 2017 at 10:03 am #

      Hi,
      No option is added, Decent Comments widget comments are always suffled.
      If you are using any cache plugin, maybe this is the problem.
      Kind Regards,
      Antonio B.

  6. Bahram May 16, 2017 at 11:12 am #

    Hi
    i use cache plugin but delete all caches, i mean here in admin panel: (link of screenshot below)
    https://drive.google.com/open?id=0B_jnn2DpYxAcWndIdFBOU3hnQlU
    do i have to change anything here?
    best wishes

    • antonio May 17, 2017 at 6:31 pm #

      Hi,
      You should not have to change it.
      If you can, please disable the cache plugin and test the random widget. I suppose that the cache plugin is caching the widget and this is the reason because the comments are ordered.
      If the problem persists, you can share your function.php file using pastebin.com, maybe here is the problem.
      Kind Regards,
      Antonio B.

      • Bahram May 22, 2017 at 7:09 am #

        Hi again Antonio
        i disable cache plugin and delete all caches but its still not working
        i want it for site main page and don’t want to display repetitious comments, its my function.php:
        https://pastebin.com/CMfB0gRy
        can you add this option on new update pls?
        thanks for your help and time
        best wishes

        • antonio May 23, 2017 at 6:51 am #

          Hi Bahram,
          Really I don’t know why the comments are not shuffled, maybe this filter is not executed, you could try to add a temporal character ‘_’ before the avatar to test if this code is executed, ex. changing:
          $output .= '';
          to
          $output .= '_';
          In any case, we will study it for future updates.
          Kind Regards,
          Antonio B.

          • Bahram May 24, 2017 at 9:02 am #

            Hi
            i add ‘_’ in function and its appear in comments before avatar then the code and function.php is executed…
            u can check it in site main page footer
            🙁

            • antonio May 25, 2017 at 7:35 am #

              Thanks Bahram,
              Then I would say it is cache problem, either by a plugin, or by the server.
              If you can disable everything related to cache and try it.
              Kind regards,
              Antonio B.

              • bahram May 30, 2017 at 7:18 am #

                Hi again dear Antonio
                i disable everything related to cache and nothing changes but i discover something…
                they are five constant comments that display, but every time that i refresh page the order of this five changes, for example if first time a comment is on top for second time its at the end and if again refresh page its come on middle for example. i don’t know do u get what i mean? sry my English is not good

                • antonio May 30, 2017 at 7:47 am #

                  Sure,
                  shuffle mix the elements. Maybe if you set a higher limit and then truncated the array you could do.
                  Ex. If you want to display 5 comments, you can set as limit 20 comments, and in our function set:
                  function random_decent_comments_comments_output ( $output, $comments, $options ) {

                  shuffle( $comments );
                  $comments = array_slice($comments, 0, 5);
                  ....
                  ....
                  }

                  Kind Regards,
                  Antonio B.

  7. Bahram May 30, 2017 at 10:10 am #

    tanks, it finally works! 😀
    i really appreciate your help

    • antonio June 1, 2017 at 6:50 am #

      Perfect.
      Kind Regards,
      Antonio B.

Leave a Reply