Title: &quot;post_html&quot; problem using PHP code
Last modified: August 21, 2016

---

# "post_html" problem using PHP code

 *  Resolved [pixelkicks](https://wordpress.org/support/users/pixelkicks/)
 * (@pixelkicks)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/post_html-problem-using-php-code/)
 * Hi,
 * I’m using the wpp_get_mostpopular function, and trying to customize the post_html
   variable.
 * Using the example code as such, it works correctly:
 * `<li>{thumb} <a href='{url}'>{text_title}</a> </li>`
 * However I want to modify it to the following, but it doesn’t display anything
   at all:
 * `<li> <a href='{url}'>{text_title}{thumb}</a> </li>`
 * Why is this? Shouldn’t it allow me to format the output as I wish?
 * Thanks,
 * Chris.
 * [https://wordpress.org/plugins/wordpress-popular-posts/](https://wordpress.org/plugins/wordpress-popular-posts/)

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

 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/post_html-problem-using-php-code/#post-5054926)
 * Hey, Chris!
 * > However I want to modify it to the following, but it doesn’t display anything
   > at all
 * It sounds like you didn’t escape the quotes properly, breaking the function. 
   Please post the full code so I can take a look.
 *  Thread Starter [pixelkicks](https://wordpress.org/support/users/pixelkicks/)
 * (@pixelkicks)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/post_html-problem-using-php-code/#post-5054955)
 * Hi Hector,
 * The example you’ve given doesn’t say you need to escape the quotes. Here’s what
   I’m using:
 *     ```
       <?php
       $posthtml = "<li><a href='{url}'>{text_title}{thumb} </a> </li>";
       ?>
       <?php wpp_get_mostpopular("range=weekly&limit=8&order_by=views&title_length=8&title_by_words=1&thumbnail_width=237&thumbnail_height=177&stats_views=0&freshness=1&post_html=".$posthtml);
       ?>
       ```
   
 * Simply moving the {thumb} variable inside the a tag causes it not to work.
 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/post_html-problem-using-php-code/#post-5054978)
 * This works for me:
 *     ```
       <?php
       wpp_get_mostpopular( "range=weekly&limit=8&order_by=views&title_length=8&title_by_words=1&thumbnail_width=237&thumbnail_height=177&stats_views=0&freshness=1&post_html=\"<li><a href='{url}'>{thumb} {text_title}</a> </li>\"" );
       ?>
       ```
   
 * However, notice that the _{thumb}_ tag returns a linked thumbnail (eg. `<a href
   ="URL-HERE"><img src="IMG-URL-HERE"></a>`). You’d be embedding an A tag inside
   another one with that code, which is not valid HTML.
 * I believe using [WPP’s filter hooks](https://github.com/cabrerahector/wordpress-popular-posts/wiki/3.-Filters)
   on your case might be more appropriate. [Check this sample code](http://wordpress.org/support/topic/add-really-simple-share-plugin-to-the-widget?replies=6#post-5742660),
   might be useful for you.

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

The topic ‘"post_html" problem using PHP code’ is closed to new replies.

 * ![](https://ps.w.org/wordpress-popular-posts/assets/icon-256x256.png?rev=1232659)
 * [WP Popular Posts](https://wordpress.org/plugins/wordpress-popular-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpress-popular-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-popular-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-popular-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-popular-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-popular-posts/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * Last activity: [11 years, 10 months ago](https://wordpress.org/support/topic/post_html-problem-using-php-code/#post-5054978)
 * Status: resolved