Notice: Trying to get property of non-object in /home/wpcmsnin/snippets.wpcms.ninja/wp-content/plugins/wordpress-seo/frontend/schema/class-schema-utils.php on line 25

Creating a Testimonial System using WordPress Creation Kit

, ,

First step is to create the Post Type under the Post Type Creator.  Under Supports: you should only leave title checked off.  For post_type in the example I am giving I used ‘wpcmsninja_reviews' but you can set this to whatever you would like, just need to make sure you customize the code below as needed.

After you create the post type you need to go to Custom Fields Creator and create the Custom Meta Box.  Here you will want to name it something unique, select wpcmsninja_reviews as the post type, repeater remains false, sortable should be set to true so you can control the order the reviews show in.  Next we will be adding in the fields you wish to record: Review, Review Author, and Review Email. Review I set to a textarea field type that is required with number of rows set to 5.  I put in a description of “This testimonial will be visible to the public.” for Review.  Review Author I set to a text field type that was also set to be required.  I set the description for Review Author to “Your name will be visible to the public.”.  Review Email I set to a text field type and also made it required.  I set the description for the email to “Your email will be kept private. ” because I decided not to show the email address of the review inside the template.  You can add any field you would like here if you would like to collect any other info.  You just need to make sure you look at the Field Slug that gets generated and use it in the correct spot for your code.

Next step would be to add the Options page to the post type.  Go into Option Pages Creator and add a new one with the title of “Review Options Page”. Make sure to set Page Title and under the Page Type choose Submenu Page.  Under the Parent Slug you will want to set this to the Admin URL that is the new post type, in my example I set it to: edit.php?post_type=wpcmsninja_reviews.  I then went into the Option Fields Creator and created three separate fields, To Email Address, CC Email Addresses, BCC Email Addresses.  For To Email Addresses I used that for the Group Title, I selected “Review Options Page” as the Option Page, and for the Option Name I put in to_email_address. Repeater and Sortable was set to false because there is only going to be one email address entered in here.  I then added a field with a Field Title of “To Email Address”, Field Type of text and I set required equal to true.  For the next one I used “CC Email Addresses” as the Group Title, selected “Review Options Page” as the Option Page, set “cc_email_addresses” as the Option Name, set the Repeater to True, and the Sortable to false.  I then added the “CC Email Address” field with that as the Field Title, selected text as the Field Type, and set it as a required field.  I then repeated the process for BCC Email Addresses as I did with the CC Email Addresses.

Next I went into the Swift Templates system and created a template to use.  Selected “wpcms_reviews” as the Custom Post Type, and added a Query Argument of Posts Per Page and set it to -1 so it would show all reviews.  The below template shows the template within quotes and on the next line puts a dash with the reviewers name.

Then on the page that you would like to have the reviews listed it is as easy as putting in the following shortcode.

Next you will want to create a Frontend Posting form.  So you can go to this menu option and select Add New and name it “WPCMSNinja Reviews”.  For Post Type select wpcmsninja_reviews, set Anonymous Posting to yes, under Assign to user you can select anyone. I would recommend you set Admin Approval to Yes.  Under Field Type you will see “CFC-WPCMSNinja Reviews” as this is what we named the Custom Meta Boxes under the Custom Field Creator.  You can then customize the Form Labels and Messages as you see fit.  The shortcode you will use on the form page will show below the Publish or Update button.

Here are some of the functions that I then added to my themes function file or you can also create a custom plugin.

The below function sends out an email notification based on the

 

Skills

Posted on

September 20, 2018

Submit a Comment

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