Fun with in-context comments
Fun with in-context comments allows you to ask your readers questions when they provide comments on your blog. The intention is these answers can provide the context that long lists of comments, especially support comments, sorely need.
Requirements
You must be using WordPress 2.5
You must be using a theme that follows the conventions for displaying comments set out in the WordPress default theme, i.e. the markup, classes and IDs, filters and action tags that are used by the default theme.
Features
The questions can be created once, globally, and applied to each post individually, or you can create post specific questions as you are editing.
The answeres will be published either above or below the actual comment, and is formatting according to your settings.
The answers also show in the admin comments list.
No alterations to any files are necessary but template tags are provided for those that want additional control.
Compatible with WP Ajax Edit Comments version 2.1+.
Installation
Add to the plugin directory then turn it on.
Once activited you will find that there is a new tab beneath the comments menu called Global Contexts and a new advanced option on the write page called Comment Context.
You don’t need to modify any files for the plugin to work, it will add all of the necessary content; however, there are two template tags which you can use if you want to change the way the content is output.
Filter Fields
The following template tag controls where, and how the filter fields are inserted. By default these are included before the comment page is added.
The filter title takes either a string, containing the full html for the title, or false, in which case it will use the default title.
<?php comment_context_filter_fields( ‘<h3>Filter Title</h3>’ ); ?>
If you use this tag then the automatic system that inserts the default tag will turn off, but you will need to load the page twice before you see the difference.
Context Fields
By default the options that the commenter has are presented underneat the comment area, but you can use the following template tag to change that position:
<?php comment_context_fields(); ?>
I recommend placing this after the commenters details, but before the comment textarea. As with the other templte tag, using this will prevent the automatic system from including it further on down the page.
Now you are ready to use the plugin.
Usage
There are two places where you can modify how this plugin works.
- On the bottom of each post, or page, screen there is a new area called ‘Comment Contexts’; and
- If you click on the Comments main menu you will see a new page called ‘Global Contexts’.
We will start with the second of these.
Once you have entered the Global Contexts page you will notice that you can alter the way the users results are displayed. For now leave the settings as they are.
The first thing you should do is to create a test question, so scroll down to the form at the bottom of the page. The interface should be self-evident. To add a new one complete the fields:
- Question, this is the actual question displayed to readers.
- Caption, this is what is displayed on the comment itself once it is published on the page. Think of it as a title.
- The values available, this is a list of the values the user can choose from. Enter one per line.
Now hit save. You should see an entry in the table above the form.
To edit the question click on the title. To delete it check the box and hit delete.
To add this question to an actual post visit the editing screen for that post. Scroll down to the advanced area and you should an area for ‘Comment context’.
You will see a checkbox for each global question that you added. Checking the box and saving the post will ask users that question.
Alternatively, or as well as, you can add one or more questions that are specific to this post using the same fields below the checkboxes.
If you want to change the way the comment contexts are displayed you can do so by amending the settings at the top of the global contexts page.
The contexts are displayed in the following format:
[Before Results Text][Context Title][Separator][Context Result][Between Contexts Text][next]
or
[No Results Text]
In either case the text that makes up each of the above is inserted into the template in place of ‘%content%’.
So, if the template is <div>>%content%</div> then comments will look like:
<div>[Before Results Text][Context Title][Separator][Context Result][Between Contexts Text][next]</div>
Aggregating Results
From version 0.3, the plugin features two shortcodes that can be used to list the results of a particular question.
The first shortcode displays the results as an unordered list:
[context_count title=”" ]
The title must be the title of the context. So if you have asked your commenters what version of WordPress you are using, and given it the title ‘WordPress Version’ then you use ‘WordPress Version’.
If you want to limit the count so it only uses a person’s answer once then include `count_individuals=”true”`. This will use only the most recent answer from each commenter.
If you want to exclude one or more commenters from the count you can use `exclude_emails` and enter a list of e-mails separated by a comma.
The second shortcode displays the results as a bar chart using the Google Charts API.
[context_count_graph title=”"]
In addition to the comment_count options the following options are also available for the graph:
- height - the height in pixels, use numbers only.
- width - the width in pixels, use numbers only.
- direction - use the letter h, or the letter v to determine which way up the graph is.
Depending on the direction chosen a minimum height, or width will be calculated so that the graph isn’t clipped when a commenter selects a choice that hasn’t been chosen before.
- color - a hex value (without the #) e.g., cccccc.
- colour - a hex value (without the #) e.g. cccccc but spelled nicely.
- chart_title - the title to display at the top of the chart.
- bar_width - width of each bar in the chart, in pixels, use numbers only.
- bar_spacing - the spaces betwee each bar in the chart in pixles, use numbers only.
- background_fill - a hex value (without the #) e.g. cccccc.
Download
You can download it from WordPress Extend: Download Fun with in-context comments.
License
This plugin is GPL.
Please add any support queries to the comments below, or use the WordPress extend support system.
Video
Sample Count Graph
This graph shows the number of commenters that have specified a particular version of WordPress
- Permalink
- Andrew Rickmann
- 7 Jun 2008 1:06 PM
- Comments (22)
June 9th, 2008 at 7:24 am
[...] Over the weekend I released the plugin that I intend to enter into the Weblog Tools Collection Competition: Fun with In-Context Comments. [...]
June 11th, 2008 at 4:27 pm
This comment relates to : WordPress Version : 2.5.x, Plugin Version : 0.1.1
Just wondering will my answers be shown to others or not?
June 11th, 2008 at 5:36 pm
Arturs, I guess you have your answer.
One of the reasons for the plugin is so that others can see what version the comment related to. The next update will let users filter the comments based on those answers as well.
June 15th, 2008 at 1:43 pm
[...] have released version 0.2 of Fun with In-Context Comments today. This post gives a quick rundown of the [...]
June 15th, 2008 at 7:36 pm
This comment relates to : WordPress Version : 2.5.x, Plugin Version : 0.2
Oooh, just can’t help trying out 0.2.
Edited: Wow, this is too cool Andrew. You did a great job.
June 15th, 2008 at 8:15 pm
This comment relates to : WordPress Version : 2.5.x
Thanks for the explanatory video, Andrew. Without it I couldn’t quite understand how the plugin works.
Question: will the other commentors (who subscribed to comments) get the in-context comments in email as well, in other words, do in-context comments show up in email?
Edit: oh, I really like how you integrated it with Ron’s AEC plugin!
June 15th, 2008 at 10:23 pm
This comment relates to : Plugin Version : 0.2
Thanks guys.
Adding the extra hooks to AEC really helped Ronald and I think it helps make this that much more useful. As did your point about the necessity of editing files.
Viven, I haven’t done anything to add the context to e-mails yet. It is something I have thought about but I wanted to think it through first. When I do add it, if there is a need to integrate with subscribe to comments then I will do.
June 16th, 2008 at 11:36 pm
[...] Rickmann, friend and fellow RA Project contributor, has released a new plugin called Fun With In-Context Comments for WordPress [...]
June 17th, 2008 at 8:04 am
This comment relates to : WordPress Version : 2.5.x, Plugin Version : 0.2.5
That’s a nice one. I think I’ll use it in the future! Thank you very much!
June 20th, 2008 at 7:48 am
[...] attendre un reload de la zone de texte pour en profiter. Dommage. Et ma nouveauté favorite : le Fun with in Context Comment, que j’ai découvert au détour d’une mise à jour du plugin de controle des [...]
June 20th, 2008 at 7:58 am
[...] Fun With in Context Comment (0.25) => Ajoute un petit sondage ou non à chacun de tes articles, que le lecteur pourra valider avec ses commentaires. [...]
June 22nd, 2008 at 8:28 am
[...] This morning I released version 0.3 of Fun with in-context comments. [...]
June 30th, 2008 at 12:38 am
This comment relates to : WordPress Version : 2.5.x
Came across a ‘review‘ plugin just now which made me think of Fun with in-context comments and how it might be extended to include umm… these star/rating icons
July 1st, 2008 at 4:22 pm
This comment relates to : WordPress Version : 2.5.x, Plugin Version : 0.3
Thanks Mosey, I will take a look at that.
July 10th, 2008 at 8:24 pm
[...] Fun with in Contencxt Comments - An die Leser Fragen stellen und ein Auswahlmenü mit Antworten zur Verfügung stellen, die dann per Drag und Drop da sind. [...]
July 29th, 2008 at 10:08 am
This comment relates to : WordPress Version : 2.6, Plugin Version : 0.3
Achei um tanto quanto confusa a aplicação, mas basta usar a inteligência pra desenvolver algo útil e funcional.
This is very confused, but very, very interesting. Nice. I like it.
July 31st, 2008 at 11:54 pm
This comment relates to : WordPress Version : 2.6, Plugin Version : 0.3
Eu quería mostrar um título diferente dos resultados dentro do comentário, mas o código customizado não funciona.
Me ajude
I wanna show a title different of results inside the comment, but the customized code
[Before Results Text][Context Title][Separator][Context Result][Between Contexts Text][next]
don’t work
Help me
Tks
August 1st, 2008 at 6:11 am
passageiro, I’m not sure I understand your question.
Can you tell me what you have typed in to which form fields and what is happening that is not what you expected?
August 2nd, 2008 at 5:12 am
[...] ???????????????????????http://www.wp-fun.co.uk/fun-with-in-context-comments/ [...]
August 2nd, 2008 at 6:48 am
This comment relates to : WordPress Version : 2.6, Plugin Version : 0.3
Hi!I found your plugin is not compatible with Wordpress Thread Comment.
If I use both of them ,it can only display the first commentator’s selection.
Though the following commentators select their answers ,it looks like your plugin didn’t get the information.
When I deactive ” Wordpress Thread Comment “,your plugin returns to normal.
August 2nd, 2008 at 8:54 am
This comment relates to : WordPress Version : 2.6, Plugin Version : 0.3
Dora.
I have tested them together and I can’t find any problems. They both seem to be working as expected.
August 15th, 2008 at 1:57 pm
This comment relates to : WordPress Version : 2.5.x, Plugin Version : 0.3
This is a pretty interesting plugin, will be looking at it.
The edit feature of ajax edit comments works nice as well