Pippins Plugins
  • Email
  • Facebook
  • Feedburner
  • Github
  • Google
  • Twitter
  • Vimeo
  • Youtube
  • Rss
  • About
  • News
  • Join the Site
    • Member Benefits
    • Member Plugins
    • Email Notifications
  • Plugin Store
    • Affiliate Area
    • Checkout
  • Plugins
    • Plugin Portfolio
      • Plugin Portfolio – List View
    • Free
    • Premium
    • Member Plugins
    • Coding Standards
    • Get Plugin Support
  • Tutorials
    • Series
      • Plugin Development 101
      • Creating a User Follow System Plugin
      • Customizing Restrict Content Pro
      • Displaying Content with Easy Content Types
      • Writing Your First WordPress Plugins, Basic to Advanced
      • Working with Widgets
      • User Submitted Image Galleries
      • Plugin Thoughts
      • Integrating Stripe.com with WordPress
      • WordPress Rewrite API
    • Member Exclusive
      • Free Members
      • Subscriber Only
    • Difficulty
      • Beginner
      • Intermediate
      • Advanced
    • Action and Filter Hooks
    • Ajax
    • Custom Post Types
    • External APIs
    • Short Codes
    • Taxonomies
    • Video Tutorials
    • Widget Tutorials
    • WordPress Admin / Dashboard
    • Working with jQuery
    • WordPress Database
    • Writing Plugins
    • Tag Index
  • Reviews
  • Support Forum
  • Contact
    • Support the Site
    • Request Code Review
    • Plugin Support

Making a Simple Rating Field Type in Easy Content Types

Posted on February 15, 2012 by Pippin in Action and Filter Hooks, Advanced, Member Restricted, Subscriber Only, Tutorials, Video Tutorials, Writing Plugins 4 Comments
Home» Tutorials » Action and Filter Hooks » Making a Simple Rating Field Type in Easy Content Types
Tweet
Love It - 2

Several users have requested that I build a “rating” field type for Easy Content Types that will allow administrators / editors to apply a rating to a post or custom post type entry. This sort of field type would be exceptionally useful for users running review websites, such as book, movie, or game reviews. I have gone ahead and built a simple star/number rating field type, and would like to share with all of you the methods used to build such a field type. It is a little complicated, but if you’re already familiar with adding new field types in Easy Content Types, you won’t have any problems.

If you have not already watched my tutorial on how to register custom meta field types in the plugin, then go watch it now.

The field types we will be creating look like this:

When rendered on the front end, our fields will look like this (when using the automatic display meta function):

In the video, I walk you through all of the functions (except the last two; the reason is explained in the video) and describe the process of setting up the new field type. To aide you in building your own rating field type, the complete code is below:

You must be logged in and have an active premium membership to view the rest of this content. Register or login from the sidebar.


Related Items
  • Registering Custom Meta Field Types for Easy Content Types
  • Easy Content Types
Tweet Follow @pippinsplugins
easy content types

4 comments on “Making a Simple Rating Field Type in Easy Content Types”

  1. rsmelik says:
    July 31, 2012 at 11:50 pm

    Pippin,

    This tutorial is awesome! I had asked you for some sort of integration of this feature back when I bought ECPT but haven’t gotten around to diving into the tutorial until now! I personally liked how you worked through some of the the issues with the code. It got me thinking in a new way. I am not a PHP expert so I am picking up this stuff as I go along and it good to see the problem solving side of things.

    So I know you mentioned that if I wanted a short code I needed to add that as a new short code function but what about if I wanted to hard code this into my template. I am able to see the script in action, using the auto display function in my ” Books” post type (visible at the end of the post) but I haven’t yet been able to figure out the correct equation for the PHP string that I need to add to my template file. The usual doesn’t seem to populate the right data. It is returning the number rating instead of the star rating. You can see what I am talking about on this page:

    http://www.designbuddha.com/books/information-graphics/

    The rating below the content is correct and was added via the automatic feature in ECPT but the rating above the bookshelf was my attempt at hard coding the query into my template file. Unfortunately it didn’t return the correct data.

    Any thoughts/suggestions?

    Thanks! – Rob

    Reply
    • Pippin says:
      August 1, 2012 at 8:43 am

      Is that page using the short code? Also, is it using the number or the star rating?

  2. samasmar says:
    August 31, 2012 at 5:20 am

    Hey Pippin, thanks for your great plugins tutorial. I’ve found an issue when trying to display star ratings with shortcodes.

    These both displays the rating in a number format. However if I do it from the ecpt settings by activating “Check this box to automatically display meta box field values after the item content for the post type” it works perfectly. Please advise. Thanks
    Sam

    Reply
    • Pippin says:
      September 1, 2012 at 8:32 pm

      Sam, this tutorial simply showed how to make the fields, and displaying them via short codes was not included. You will have to extend the code to do that.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  • Login

Lost your password?

Please enter your username or e-mail address. You will receive a new password via e-mail.

  • Facebook Become a Fan Like

  • Twitter Subscribe on Twitter Follow

  • YouTube Follow my Videos Subscribe

  • RSS Feed Subscribe with RSS Subscribe

Easy Digital Downloads

Most Loved

  • Love It Pro for WordPress
  • Write a “Love It” Plugin with Ajax to Let Users Love Their Favorite Posts / Pages
  • Simple Notices Pro Plugin for WordPress
  • User Bookmarks for WordPress
  • Front End Registration and Login Forms Plugin

Similar Plugins and Posts

  • Jobs Posting with Easy Content Types and Gravity Forms
  • Adding a Simple Image Gallery with the Repeatable Upload Field
  • Repeatable Upload Fields for Easy Content Types
  • Creating a Simple Events System with Easy Content Types
  • Registering Custom Meta Field Types for Easy Content Types

Latest Premium Content

  • Plugin Development 101 – Introduction to Adding Dashboard Menus
  • Plugin Development 101 – Intro to Loading Scripts and Styles
  • User Follow System – Part 5
  • Plugin Development 101 – Intro to Short Codes
  • Plugin Development 101 – Registering a Custom Post Type
  • Plugin Development 101 – Intro to Actions

Latest Tutorials

  • Submitting Your First Pull Request to a WordPress Plugin on Github (2)

    Github is an extremely popular tool for managing WordPress plugins, and one...

  • Plugin Development 101 – Introduction to Adding Dashboard Menus (1)

    Adding new menus, both top level and sub level, to the WordPress Dashboard is a really common task for plugins...

  • Plugin Development 101 – Intro to Loading Scripts and Styles (16)

    In this part of Plugin...

Enter your email to receive automated updates when new posts are published

Latest Tweets

  • RT @pdclark: FINALLY releasing Styles 1.0 for WordPress! This has been a long time coming. :) And it supports TwentyThirteen! http://t.co/q…
    May 21, 2013
  • Shipped some serious code tonight, and now to hit the sack. https://t.co/1V68FVHYWg
    May 21, 2013
  • @tnorthcutt https://t.co/AuWTLzmqOY
    May 21, 2013

Topics

Rémi Corson shortcodes Tom McFarlin add_options_page the_content get_user_meta contextual help Sugar Event Calendar featured add_shortcode attachments campaign monitor wp_enqueue_script short codes mail chimp authors Related posts attachment plugin image login forms do_action recent posts post types bbpress apply_filters comments short code taxonomies custom post type images Ajax gallery Stripe taxonomy jquery widgets users add_filter easy content types add_action widget restrict content pro easy digital downloads

Weekly Newsletter

Useful Links

  • Join the Site
  • Plugin Store
  • Affiliate Area
  • Tag Index
  • Support the Site
  • Suggest a Tutorial
  • Random Post
  • Contact

Monthly Archives

(c) 2011 Pippin's Plugins