I run a multiple author site and the content is directed to various age groups. Instead of forcing the writer to manually note which age group the post is appropriate for, I want to add a content rating system with the following labels:

G — Suitable for all audiences

PG — Possibly offensive, usually for audiences 13 and above

R — Intended for adult audiences above 17

X — Even more mature than above

What would be a good way to add such feature? Ideally, on the post page, there is an area with radioboxes where the writer can make their selection. There must be a way to echo the choice in the post template.

Please provide code example if you choose to answer as my coding knowledge is limited.


Custom field will do the task. On the post page there's nothing to do great, just create a Custom Field called agerating or age-rating. Authors will enter the value of the field according to their content with G/PG/R/X.

Then at the frontend, edit single.php. Use this code inside the loop to retrieve the rating value:

<?php $age-rating = get_post_meta($post->ID, 'age-rating', true); ?>

Now use this code to show the rating:

Rated As: <?php echo $age-rating; ?>

Change the codes according to your needs. You can also style the Custom value box inside the Post panel after becoming experienced with this.

More Details: http://codex.wordpress.org/Custom_Fields


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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