Check our WordPress 101 & 201 FREE Video Tutorials here
Jump to content
richard751

[WP Review Pro] Implement with custom post type via template files

Recommended Posts

Hi

I want to implement WP Reviews Pro with a third party directory plugin. I see I can add a short code to posts, however, will need a review form to be visible on user submitted posts from the front end of the website.

Is it possible to add some kind of shortcode to the template (PHP) files of the 3rd party plugin and WP Reviews can assign the review to the individual posts?

Many thanks

Share this post


Link to post
Share on other sites

Hello,

Thank you for contacting MyThemeShop today and for the interest in our plugin.

Yes this should be possible, you can invoke the WP Review Pro shortcode by making use of the do_shortcode() function on a page template like so:

<?php echo do_shortcode("[wp-review]"); ?>

I hope this info helps. Thank you.

Share this post


Link to post
Share on other sites

Hi

Thanks for your response, sorry I should have made myself clearer though. I have already tried this with the free version and although the reviews appear they are the same for every post, I would like each post to have its own review.

Is there a way to make the shortcode check against the post id?

Thanks

Share this post


Link to post
Share on other sites

HI there,

Thanks for the question.

Yes this is possible you can assign an ID to the review shortcode to get the review from a specific post. The review ID is the same as the post id. The code would then look like so:

<?php echo do_shortcode("[wp-review id="123"]"); ?>

Please take a look at the following help page for all the example shortcodes that can be generated https://mythemeshop.com/kb/wp-review-pro/wp-review-pro-shortcodes/

I hope this info helps.

Share this post


Link to post
Share on other sites

Hi

Thanks for this but unfortunately it doesn't answer my question. I won't know what the Post ID is and this is a template.php file so will need the shortcode to dynamically get the post ID from whatever post the visitor is on.

The page link you sent doesn't explain this as far as I can see and I don't want to spend the money on this plugin if it doesn't do this, can you confirm the code I would need to use to make the shortcode identifiy what post ID the visitor is on so the review they leave is linked to the right post?

Many thanks

Share this post


Link to post
Share on other sites

HI Richard,

Thanks for the follow up and sorry if I was not clear enough.

By default, when the shortcode is called without an ID, it will automatically take the current post id, the below code should be able to work for the current item when called within a posts loop:

echo do_shortcode("[wp-review]");

This will apply if your plugin makes use of custom post types.

I hope this info helps.

 

Share this post


Link to post
Share on other sites

Hi, I have the exact same problem.

When I add the shortcode [wp-review] it only loads the same global template, however I have different post types (different types of products to review) so the same template won't fit all of the post types I have.

For exemple, I would need some pre-defined rating criteria for restaurant (eg. menu quality, service, value for money) and other pre-defined criteria for hotels (location, cleanliness, etc). As I tested I could only have one single template for the whole website and not one different depending on post type.

And I have set up different post types for each product type I have because I needed different templates and fields for each.

So, my question is: Is there any way to create those "global" templates specifically for each post type?

As I run a big directory where I am constantly adding tons of content all the time, I would need to have those criteria defined automatically when I created a new post, so users can go straight to add the reviews, but different pre-defined criteria should load depending on that post type.. 

Before purchasing the plugin I had read the shortcodes guide and saw it had the exemple [wp-review id="123"], but I imagined this ID would be some sort of form templates (as it's done in other review plugins) and not the post ID (which I actually don't see how this can be useful)..

Thanks,

Share this post


Link to post
Share on other sites

Hello, 

Thank you for your cooperation and patience with us. 

If the template/PHP file is related to custom post type then you can use 
 

echo do_shortcode("[wp-review]");

But if you are looking forward to using it on some custom page,  you will have to use a post id with the shortcode and the shortcode will be added to the content editor instead of the php template file. 

Hope this helps. 

Thank you.


🏁Rank #1 on Google With our WordPress SEO Plugin.

Score a 💯on PageSpeed and Dominate Search Rankings.

✏ Editing theme files? Please create a child theme to make your changes update-proof.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×