Review table of different products

Front Support Plugins Support WP Reviews Plugin Review table of different products

This topic contains 12 replies, has 4 voices, and was last updated by  Hesham 4 years ago.

  • Author
  • #2565

    Irene Mendoza

    How do I make a table containing the products with rating. I understand that there is no shortcode for this yet. But can I do this in php code? Or any workaround?

  • #2596

    Hi Irene,

    every rating is an normal post and has therefore the normal metadata and objects. I have build such a table here:
    together with footable for responsive design

    Maybe this helps, feel free to contact me for further questions

  • #2610

    Dylan O’Neil


    Very slick what you did there. Been looking to do something similar to that.

    Did you hand code that table or is there a way to dynamically load in a category or tag of posts? How did you accomplish this?

    We are using the plugin to review services in different areas and would like to be able to show a table of all the companies in a certain area. Having to hand code all them would be quite the pain 🙂


  • #2612

    Hi Dylan,

    if this would be a pain depends on your data structure 😉

    the reviews are a custom post type with a custom taxonomy and the table is build by two “foreach-loops in php.
    The first gathers the taxonomies of a given custom post type and build the table headers from it,
    the second one iterates over all posts in this custom post type and prints a row from it.

    in your case i would query for a taxonomy e.g called “Middle West Texas” and then print all entries with this taxonomy.

  • #2614

    Dylan O’Neil


    Thanks for your response 🙂

    We don’t have much of a structure built yet, so we can be sure to avoid making it more painful than necessary.

    I understand basically what you are talking about here, but do not know php. I however am somewhat handy with code, so can probably figure it out if you were able to send me some sample code of maybe how you did it or a link to someplace with more information on doing what you are talking about. Do you have something you could help me with here?

  • #2616

    Dylan O’Neil


    I actually think I found a plugin that does this:

    It say that the creator’s name is Stefan, so this may be your plugin, so if it is, thanks! 🙂 It does exactly what I’m looking for it seems.

    However, it requires me to have the name of the custom fields to load the data from. I was crawling through the PHP but couldn’t find anything helpful. What are the names of the custom fields I should be using here? Most specifically, I’m looking to get the rating.

  • #2619


    The names of all required Custom Fields are shown in the Custom Meta area, which can be found in any of your reviews. (Just make sure you actually display the Custom Meta within the Screen Options at the very top of your Post Edit page.

    The Rating field though is named : ta_post_review_rating

    I hope this helps.

  • #2620


    If you still building your site, then I recommend using a plugin to Create Custom Post Types, a good one I am using is the Types plugin (which is free), it will help you organize your content, then you can use the Top Rated Reviews widget to create something like this:

    On that site above, I’ve created three Custom Post Types : Themes, Plugins, and Hosting. Then on each type’s archive/posts page I used the Top Rated Reviews widget that is part of the WP Reviews plugin to list products within that specific type.

    This will be much easier than actually coding it yourself.

    I hope this helps.

  • #2634

    @dylan: no thats not me 🙂

    Are the tables generated from this plugin fully responsible and create valid HTML5 code?

    Well i personally tend to reduce the amount of plugins used in my sites since most of them add more clutter than help.

    Here is the way i coded my table from hand:

    <th data-class=”expand”> Name </th>
    // loop to all given taxonomies to seminarbewertungen and create a table column out of it
    foreach (get_object_taxonomies(array(‘post_type’ => ‘seminarbewertungen’, ‘objects’)) as $taxonomy) {
    $value = get_taxonomy($taxonomy);
    //decide which column is shown on which screensize
    switch ($value->singular_label){
    case ‘Abschluss’;
    case ‘Typ’;
    case ‘Branche’;
    echo ‘<th data-hide=”phone”>’.$value->singular_label.”</th> “;
    echo ‘<th data-hide=”phone,tablet”>’.$value->singular_label.”</th> “;
    <th data-hide=”phone”> Bewertung </th>

    And the table body:
    <?php /* Start loop for custom post listing */ ?>
    <?php $loop = new WP_Query( array( ‘posts_per_page’ => -1 , ‘post_type’ => ‘seminarbewertungen’ )); ?>
    <?php while ($loop -> have_posts()) : $loop -> the_post(); ?>

    <td><?php echo the_title()?>” title=”<?php echo the_title()?>”> Zur Bewertung</td>
    <?php foreach (get_object_taxonomies(array(‘post_type’ => ‘seminarbewertungen’, ‘objects’)) as $taxonomy_single) {
    $terms = wp_get_post_terms($post->ID,$taxonomy_single,’orderby=term_taxonomy_id&hide_empty=1′);
    foreach ($terms as $term) {
    echo $term->name.”<br>”;


    <?php }?>
    <td data-type=”numeric” data-value=”<?php echo $post_rating?>”>
    $post_rating = get_post_meta($post->ID,’ta_post_review_rating’,true);
    $rating_star = $post_rating * 20; // calculate rating
    $rating_display = str_replace(‘.’, ”, $post_rating);
    $show_rating = ‘<span class=”rating r-‘.$rating_display.'” title=”‘. __(‘Rated’, ‘wp-reviews’) . ‘: ‘ . $post_rating . ‘”></span>’;
    echo $show_rating;

    <?php endwhile; // End the loop ?>

    @ Hesham: had to copy some lines from the plugin because i needed the numeric value instead of the stars to get the sorting function working.

    Do you have a reference for all custom meta elements that are used in the plugin? I would like to build my own rating box for the single review.

    e.g. in this way
    Name Value
    ta_post_review_rating: gives the numeric value of the rating

    I really need this to speed up my coding for my site 🙂

    Regards Stefan

  • #2637

    Dylan O’Neil


    Thanks for pointing me towards the Types plugin. I’m however having a hard time making it work, so maybe you can help point me in the right direction.

    I created a custom post type and a taxonomy for that post type for each area. So I have a “company” post type, then created a “custom taxonomy” for areas starting with the state, then the city underneath it. I associated the taxonomy with pages.

    I went to the pages that I had set up as reviews and then marked them in one of the city categories.

    Is this the proper way to do this in your opinion? If not, please clarify how you would go about it.

    Then, I created a page that I want the results for the certain area to show up (I would rather it not be an archive page) and then marked it with the taxonomy for the city I wanted to show results for, then put the shortcode in. I’m not sure if this is right either, but it didn’t work in giving me any results.

    I like the Types plugin, just trying to figure out how to properly implement it. Am I supposed to only try the shortcode on the archive page for the post type?


    Thanks for passing along the code, that is very helpful!

  • #2667


    Stefan, I haven’t validated the code, but the layout is responsive and it uses Twitter Bootstrap framework.

    I don’t have a list of the post meta, but you can simply fill them all with any values so that they will show under the Custom Fields (in the post editor page).

  • #2671

    Sorry hesham, this was not well thought from me. i never meant this as an offense against an plugin author. The point i had was simply to rethink to when i use a plugin vs coding it myself.

    e.g. you don’t need contact form 7 to build the single and only contact form on the whole website but you catch all the css and js-overhead.

    regarding the list: i see your point. 🙂 thx for directing me in this direction

  • #2672


    Stefan, no need to apologize.

    I see your point in your example, but coding a form is not that easy as it looks. I personally never done it, I just use Gravity Forms for all my sites even if I will have only one simple contact form. I think of spammers, and possible hackers for example, so I don’t code it myself 🙂

The forum ‘WP Reviews Plugin’ is closed to new topics and replies.