Title: PHP code commented when a category is empy
Last modified: August 21, 2016

---

# PHP code commented when a category is empy

 *  Resolved [Adriano G. V. Esposito](https://wordpress.org/support/users/adriano-esposito/)
 * (@adriano-esposito)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/php-code-commented-when-a-category-is-empy/)
 * Hi,
 * I use your very nice widget with no problems.
 * I just noticed that when a cat has no posts in the widget appears a PHP code 
   HTML commented, like this:
    <div class=”dpe-flexible-posts no-posts”><p><!–?php
   _e( ‘No post found’, ‘flexible-posts-widget’ ); ?–></p></div>
 * I would like to know if it is a possibility to modify this behavior in mode I
   have no PHP code at all insteat that commented.
 * Thank you very much!
 * Site: [http://www.cambiamolascuola.org/](http://www.cambiamolascuola.org/)
 * [http://wordpress.org/plugins/flexible-posts-widget/](http://wordpress.org/plugins/flexible-posts-widget/)

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

 *  Plugin Author [DaveE](https://wordpress.org/support/users/dpe415/)
 * (@dpe415)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/php-code-commented-when-a-category-is-empy/#post-4264831)
 * Hi Adriano,
 * Thanks for using the plugin. If I understand your question correctly, you’d like
   widget to have no text output if it doesn’t find any posts. If that is your question,
   it is possible. You’ll want to [create a custom HTML template](http://wordpress.org/plugins/flexible-posts-widget/installation/)
   first. Then in your custom HTML template, you want to remove the following lines
   of code:
 *     ```
       <?php else: // We have no posts ?>
       	<div class="dpe-flexible-posts no-posts">
       		<p><?php _e( 'No post found', 'flexible-posts-widget' ); ?></p>
       	</div>
       <?php
       ```
   
 * By removing the code in the PHP `else` block, the widget will display nothing
   if there are no results.
 * By the way, it appears [the site you referenced](http://www.cambiamolascuola.org/)
   is written in Italian. If you created an Italian translation for Flexible Posts
   Widget, I would love to include it with the plugin. Would you be open to sharing
   your translation files (PO & MO) with me?
 * Thank you!
 *  Thread Starter [Adriano G. V. Esposito](https://wordpress.org/support/users/adriano-esposito/)
 * (@adriano-esposito)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/php-code-commented-when-a-category-is-empy/#post-4264945)
 * Hi Dave, thanks for your help!
 * I did not translate the po/mo but I can translate it for you if you want.
 *  Plugin Author [DaveE](https://wordpress.org/support/users/dpe415/)
 * (@dpe415)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/php-code-commented-when-a-category-is-empy/#post-4264964)
 * That would be great. To create the Italian MO & PO file, you’d want to download
   [the plugin’s POT file](http://plugins.svn.wordpress.org/flexible-posts-widget/tags/3.2/languages/flexible-posts-widget.pot)
   and open it in an editor like [Poedit](http://www.poedit.net/download.php). Poedit
   will create the correct PO & MO files for you after you’ve translated the text
   strings in the POT file.
 * if this is not up your alley or too much work, I completely understand. Thanks
   again!
 *  Thread Starter [Adriano G. V. Esposito](https://wordpress.org/support/users/adriano-esposito/)
 * (@adriano-esposito)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/php-code-commented-when-a-category-is-empy/#post-4264965)
 * I already did this kind of stuff in the past. I will do and I’ll send to you 
   the whole po/mo pair 🙂
 *  Thread Starter [Adriano G. V. Esposito](https://wordpress.org/support/users/adriano-esposito/)
 * (@adriano-esposito)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/php-code-commented-when-a-category-is-empy/#post-4264968)
 * Back to the topic: I noticed I have in my already customized template file this
   rows echoed:
 *     ```
       echo "<div class=\"dpe-flexible-posts no-posts\">";
       echo "<p><?php _e( 'No post found', 'flexible-posts-widget' ); ?></p>";
       echo "</div>";
       ```
   
 * I really dont know why… I dont remember… Anyway your original template widget.
   php do not show this code so it is entirely a problem of mine. Sorry 😀
 *  Plugin Author [DaveE](https://wordpress.org/support/users/dpe415/)
 * (@dpe415)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/php-code-commented-when-a-category-is-empy/#post-4264970)
 * if you remove or comment out those three lines, you should get the results you’re
   looking for.
 *  Thread Starter [Adriano G. V. Esposito](https://wordpress.org/support/users/adriano-esposito/)
 * (@adriano-esposito)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/php-code-commented-when-a-category-is-empy/#post-4264971)
 * Yeah.
 * The bigger problem was that in this line
 * `echo "<p><?php _e( 'No post found', 'flexible-posts-widget' ); ?></p>";`
 * php code did not work, obviously, because it was render as a string, and I noticed
   in the html code rendered by the browser the 2 php tags showed. Now I just go
   back to your default code and the html rendered is good.
 * Thank you anyway.

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

The topic ‘PHP code commented when a category is empy’ is closed to new replies.

 * ![](https://ps.w.org/flexible-posts-widget/assets/icon-256x256.jpg?rev=984592)
 * [Flexible Posts Widget](https://wordpress.org/plugins/flexible-posts-widget/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/flexible-posts-widget/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/flexible-posts-widget/)
 * [Active Topics](https://wordpress.org/support/plugin/flexible-posts-widget/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/flexible-posts-widget/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/flexible-posts-widget/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [Adriano G. V. Esposito](https://wordpress.org/support/users/adriano-esposito/)
 * Last activity: [12 years, 7 months ago](https://wordpress.org/support/topic/php-code-commented-when-a-category-is-empy/#post-4264971)
 * Status: resolved