Title: wavematt's Replies | WordPress.org

---

# wavematt

  [  ](https://wordpress.org/support/users/wavematt/)

 *   [Profile](https://wordpress.org/support/users/wavematt/)
 *   [Topics Started](https://wordpress.org/support/users/wavematt/topics/)
 *   [Replies Created](https://wordpress.org/support/users/wavematt/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/wavematt/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/wavematt/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/wavematt/engagements/)
 *   [Favorites](https://wordpress.org/support/users/wavematt/favorites/)

 Search replies:

## Forum Replies Created

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

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP Popular Posts] Popular posts param from wpp_custom_html is a string, not an array](https://wordpress.org/support/topic/popular-posts-param-from-wpp_custom_html-is-a-string-not-an-array/)
 *  Thread Starter [wavematt](https://wordpress.org/support/users/wavematt/)
 * (@wavematt)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/popular-posts-param-from-wpp_custom_html-is-a-string-not-an-array/#post-10637282)
 * Okay I resolved my own issue. Sorry, this theme I’m working on had a custom plugin
   that was conflicting with the Popular Posts plugin. Once I deactivated the conflicting
   plugin, my code started working. Thanks for your help Hector! Sorry for the confusion!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP Popular Posts] Popular posts param from wpp_custom_html is a string, not an array](https://wordpress.org/support/topic/popular-posts-param-from-wpp_custom_html-is-a-string-not-an-array/)
 *  Thread Starter [wavematt](https://wordpress.org/support/users/wavematt/)
 * (@wavematt)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/popular-posts-param-from-wpp_custom_html-is-a-string-not-an-array/#post-10636996)
 * Hey Hector,
 * Yep that’s me haha.
 * PHP version is 7.0.31
    Plugin version is 4.1.1 Sage Theme version is 9.0.0
 * Below is a summary of the code I have implemented so far with popular posts.
 * Thank you for your help btw 🙂
 * Blade Template which calls wpp_get_mostpopular():
 *     ```
       $category = get_the_category()[0]->cat_ID;
   
       {{ wpp_get_mostpopular([
         'range'    => 'all',
         'order_by' => 'views',
         'cat'      => $category->parent,
         'limit'    => 5
       ]) }}
       ```
   
 * WPP Filter to create custom output:
 *     ```
       // My filter just passes $popular_posts to my blade template
       // The issue in this filter is $popular_posts is a string, not an array
       add_filter('wpp_custom_html', function ($popular_posts, $instance) {
           $data = [
               'popular_posts' => $popular_posts
           ];
   
           return sage('blade')->render('partials.popular-posts', $data);
       }, 10, 2);
       ```
   
 * Blade Template to render the custom html:
 *     ```
       @foreach ($popular_posts as $popular_post)
         // render each post
       @endforeach
       ```
   
 * Even without the blade usage, I could still build this HTML string by looping
   through the posts, but again – that’s where I’m stuck because its a string and
   not an array.
    -  This reply was modified 7 years, 8 months ago by [wavematt](https://wordpress.org/support/users/wavematt/).
    -  This reply was modified 7 years, 8 months ago by [wavematt](https://wordpress.org/support/users/wavematt/).

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