Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

In my blog, I sometimes post "how to" style tutorial posts. I would like to show a difficulty gauge next to the post title like 'assumed knowledge', 'time to complete', 'frustration level', 'cost' etc. They should show up in excerpts, the main page and in posts too.

Unfortunately googling with keywords "wordpress tutorial difficulty plugin" gave me irrelevant result (pages of plugin making tutorials, or plugin installation difficulties.)

The only relevant thing I found is this abandoned stack overflow post: http://stackoverflow.com/questions/4619178/wordpress-plugin-to-show-tutorial-difficulty

Anyone know a plugin that can be used for this?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

You don't need a plugin to do this. Why not just use the wordpress custom fields feature to add your custom meta data to the posts.

http://codex.wordpress.org/Custom_Fields

You can create a custom field for each that the person adding the tutorial fills in. Then take that value that is entered and add it as a class to the difficulty html on the front end which you can use to style it.

Eg, you have a div that outputs the difficulty

<div class="difficulty beginner">beginner</div>

The value "beginner" added in the div above is what was selected by the user when filling out the tutorial post.

In the post page, it would be something like this

<?php $difficulty = get_post_meta(get_the_ID(), 'difficulty');?>

<div class="difficulty <?php echo $difficulty ?>"><?php echo $difficulty ?></div>

share|improve this answer
    
Hmmm. Good idea. I will try it soon. –  Calmarius Nov 1 '11 at 11:56

As an alternative to what @Andy James above writes, you can also do it with a custom "category" taxonomy.

Recently I did sth similar for a reviews site where not only the visitors can leave a rating, but the people who write the review can rate themselves too.

I made a custom taxonomy (attached to the review custom post type, but you can of course attach it to anything else too) and used the amount of stars (1-5) as the names of the 5 categories. Then as the description of those categories, I added images. To do that you need to add remove_filter( 'pre_term_description', 'wp_filter_kses' ); to your functions file.

To show the terms' description (the images you used), you can use the following:

$reating_terms = get_the_terms ($post->id, 'rating');
                                            foreach ($reating_terms as $term){
                                                echo $term->description;
                                            }

This particular piece of code is written by @Bainternet in a previous thread.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.