Title: Adding Rate Post to custom loop
Last modified: April 19, 2020

---

# Adding Rate Post to custom loop

 *  Resolved [tsmulugeta](https://wordpress.org/support/users/tsmulugeta/)
 * (@tsmulugeta)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/adding-rate-post-to-custom-loop/)
 * I have a custom loop on this page: [https://vitapuro.mochicaweb.com/articles/](https://vitapuro.mochicaweb.com/articles/)
 * Below the post title in the loop I added this code:
    `<?php echo do_shortcode('[
   ratemypost-result]'); ?>` but nothing appears as you see.
    -  This topic was modified 6 years, 1 month ago by [tsmulugeta](https://wordpress.org/support/users/tsmulugeta/).

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Thread Starter [tsmulugeta](https://wordpress.org/support/users/tsmulugeta/)
 * (@tsmulugeta)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/adding-rate-post-to-custom-loop/#post-12699051)
 * Ok I’ve replaced:
 * `<?php echo do_shortcode('[ratemypost-result]'); ?>`
 * with
 * `<?php echo Rate_My_Post_Public_Helper::get_visual_rating($post->ID); ?>`
 * in my loop. Now stars appear but how can I make the average appear as well? I
   would like STARS + 4 (3) for example.
 *  Thread Starter [tsmulugeta](https://wordpress.org/support/users/tsmulugeta/)
 * (@tsmulugeta)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/adding-rate-post-to-custom-loop/#post-12699082)
 * Ok I did the following which gave me the Stars + Average (although not the number
   of votes).
 * `<?php echo "<div class='rmp-results-widget__visual-rating'>" . Rate_My_Post_Public_Helper::
   get_visual_rating($post->ID) . "</div> <div class='rmp-results-widget__avg-rating'
   >" . rmp_get_avg_rating($post->ID) . "</div>"; ?>`
 * If someone knows a better way, let me know.
 *  Plugin Support [Blaz K.](https://wordpress.org/support/users/blazk/)
 * (@blazk)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/adding-rate-post-to-custom-loop/#post-12706276)
 * Hi [@tsmulugeta](https://wordpress.org/support/users/tsmulugeta/),
 * which version of Rate my Post are you using? Some methods you mentioned are deprecated
   since version 3. See the [documentation](https://blazzdev.com/documentation/rate-my-post-documentation/#global-functions)
   for more information. I have no problems displaying the results in within a loop.
   See example below:
 *     ```
       add_shortcode( 'myshortcode', 'my_shortcode_handler' );
   
       function my_shortcode_handler() {
           $args = array(
               'post_type' => 'post'
           );
   
           $post_query = new WP_Query($args);
   
           if($post_query->have_posts() ) {
             while($post_query->have_posts() ) {
               $post_query->the_post();
               echo '<p style="color:red; margin:0;">' . get_the_title() . '</p>';
               echo do_shortcode( '[ratemypost-result]' );
             }
           }
       }
       ```
   
 * Try calling [myshortcode] within post editor. Note that you need RMP version 
   3+ for this.
 * Regards,
    Blaz
 *  Thread Starter [tsmulugeta](https://wordpress.org/support/users/tsmulugeta/)
 * (@tsmulugeta)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/adding-rate-post-to-custom-loop/#post-12748318)
 * Hi Blaz,
 * I’m using Version 3.1.0
 * I will try the example you suggested and let you know how it goes. Thanks!
 *  Thread Starter [tsmulugeta](https://wordpress.org/support/users/tsmulugeta/)
 * (@tsmulugeta)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/adding-rate-post-to-custom-loop/#post-12805586)
 * For some reason echo do_shortcode( ‘[ratemypost-result]’ ) does not workin with
   my version of Rate My Post. But echo do_shortcode( ‘[ratemypost]’ ) does work.
 * echo do_shortcode( ‘[ratemypost]’ ) however causes my page to take a long time
   to load.
 * Please advise.
 *  Plugin Support [Blaz K.](https://wordpress.org/support/users/blazk/)
 * (@blazk)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/adding-rate-post-to-custom-loop/#post-12813318)
 * Hi [@tsmulugeta](https://wordpress.org/support/users/tsmulugeta/),
 * the example above utilizes do_shortcode( ‘[ratemypost-result]’ ); and it for 
   sure works because I tested it before sharing the code. Many things could cause
   a slow page load within a custom loop so for such things I would recommend getting
   a web developer. It’s a very specific issue you are encountering and thus it’s
   hard for me provide better support.
 * Blaz

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Adding Rate Post to custom loop’ is closed to new replies.

 * ![](https://ps.w.org/rate-my-post/assets/icon-128x128.png?rev=2045796)
 * [Rate My Post - Star Rating Plugin by FeedbackWP](https://wordpress.org/plugins/rate-my-post/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/rate-my-post/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/rate-my-post/)
 * [Active Topics](https://wordpress.org/support/plugin/rate-my-post/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/rate-my-post/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/rate-my-post/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [Blaz K.](https://wordpress.org/support/users/blazk/)
 * Last activity: [6 years, 1 month ago](https://wordpress.org/support/topic/adding-rate-post-to-custom-loop/#post-12813318)
 * Status: resolved