The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

code to html problem (4 posts)

  1. Dunkkan
    Posted 7 years ago #

    Hello guys,

    I'm trying to convert this bit of code to inactive php / html :

    <h2>Popular Posts</h2>
    <?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) {
    $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 } } ?>

    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

    Any ideas are appreciated

  2. esmi
    Forum Moderator
    Posted 7 years ago #

    Are you trying to run this or display it?

  3. Dunkkan
    Posted 7 years ago #

    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.

  4. esmi
    Forum Moderator
    Posted 7 years ago #

    I've got an encoding macro in my text editor which I've run at that code block, so try:


Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.