Title: code to html problem
Last modified: August 19, 2016

---

# code to html problem

 *  [dunkkan](https://wordpress.org/support/users/dunkkan/)
 * (@dunkkan)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/code-to-html-problem/)
 * Hello guys,
 * I’m trying to convert this bit of code to inactive php / html :
 *     ```
       <h2>Popular Posts</h2>
       <ul>
       <?php $result = $wpdb->get_results("SELECT comment_count,ID,post_title FROM $wpdb->posts ORDER BY comment_count DESC LIMIT 0 , 5");
       foreach ($result as $post) {
       setup_postdata($post);
       $postid = $post->ID;
       $title = $post->post_title;
       $commentcount = $post->comment_count;
       if ($commentcount != 0) { ?>
   
       <li><a href="<?php echo get_permalink($postid); ?>" title="<?php echo $title ?>">
       <?php echo $title ?></a> {<?php echo $commentcount ?>}</li>
       <?php } } ?>
   
       </ul>
       ```
   
 * I’m trying to write it with the html special entities, in the post html editor
   but doesn’t seems to work : 404 not found when I publish…
 * I’m using this online tool : [http://www.palfrader.org/code2html/code2html.html](http://www.palfrader.org/code2html/code2html.html)
 * Any ideas are appreciated

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

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/code-to-html-problem/#post-1150273)
 * Are you trying to run this or display it?
 *  Thread Starter [dunkkan](https://wordpress.org/support/users/dunkkan/)
 * (@dunkkan)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/code-to-html-problem/#post-1150286)
 * I’m trying just to dislay it, so the browser just read it as text. I changed 
   every < and > and ” tags, inside pre and code tags, but it was still being run.
 * I’ve always used a plugin to convert the code, but I’m writing as a contributor
   this time.
 * So I have no idea what can be.
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/code-to-html-problem/#post-1150339)
 * I’ve got an encoding macro in my text editor which I’ve run at that code block,
   so try:
 * [http://wordpress.pastebin.ca/1502373](http://wordpress.pastebin.ca/1502373)

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

The topic ‘code to html problem’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [esmi](https://wordpress.org/support/users/esmi/)
 * Last activity: [16 years, 10 months ago](https://wordpress.org/support/topic/code-to-html-problem/#post-1150339)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
