WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using compare theme and I am facing a problem with the tables. I have created a HTML table, which when I go to Visual mode appears to be correct.

enter image description here

But when I preview/publish it then I don't see the table. You can check it here. Only the text of cells is there.

Below is the part of code of single-product.php file which generates the page.

<div class="comparison-text">
                <h1 class="title"><?php echo stripslashes(get_the_title()); ?></h1>

                // Check if has global product description ( also stored as post meta )             
                $q = "SELECT product_description FROM ".$wpdb->prefix."pc_products_custom WHERE product_id = ".$post->ID;   
                $result = $wpdb->get_results($q);
                $content = $result[0]->product_description;

                // If no global product description use default one.

                if ($content == ''){
                    $q = "SELECT rel.id_feed, rel.id_product FROM ".$wpdb->prefix."pc_products_feeds_relationships rel JOIN ".$wpdb->prefix."pc_feeds fe ON rel.id_feed = fe.id WHERE rel.id_product = ".$merchants[0]->id_product." AND fe.feed_use_master_description = 1 AND fe.active = 1 LIMIT 1";
                    $results_f = $wpdb->get_row($q);
                        $q = "SELECT slug FROM ".$wpdb->prefix."pc_products_merchants WHERE feed = ".$results_f->id_feed;
                        $results_s = $wpdb->get_row($q);

                        $q = "SELECT feed_product_desc FROM ".$wpdb->prefix."pc_products WHERE id_product = ".$results_f->id_product." AND id_merchant='".$results_s->slug."' LIMIT 1";
                        $results_desc = $wpdb->get_row($q);

                    if (!empty($results_desc->feed_product_desc)){
                        $content = $results_desc->feed_product_desc;
                    } else {                
                        $content = get_the_content();
                        $content = strip_tags($content);

                $size = 3500;
                if(strlen($content) > $size) {
                    while(isset($content[$size]) && $content[$size] != ' ') {
                    $display_content  = substr($content,0,$size).'<span class="desc_more" style="display:none;">'.substr($content,$size,strlen($content)).'</span><span class="desc_etc">...</span> <a href="#" id="more_link" onclick="more(); return false;">'.__('More','framework').'</a>';
                    $display_content .= '';
                } else {
                    $display_content = $content;
                <?php echo $display_content; ?>

            <!-- END .comparison-text -->

I don't know PHP but I guess that $display_content is skipping the table. Does anybody know the reason of this issue and how can this be solved? I tried the Easy-Table and Tablepress plugins but they also didn't work.

share|improve this question
If you copy and paste your table HTML code in text mode and then have a look at the draft, do you still get the same results? – Laniakea Aug 21 '13 at 13:11
up vote 1 down vote accepted

Whenever $results_desc->feed_product_desc is empty, the post content is used. Otherwise the content is never used.

if (!empty($results_desc->feed_product_desc)){
    $content = $results_desc->feed_product_desc;
} else {
    $content = get_the_content();
    $content = strip_tags($content);

Whenever the post content is used, all HTML tags are stripped.

$content = get_the_content();
$content = strip_tags($content);

To get the full content with all the tags, use just the first line:

$content = get_the_content();
share|improve this answer
Thanks, I didn't notice that line. One should be patient while debugging. :) – Chankey Pathak Aug 21 '13 at 14:18
Bugs never arrive when you are patient. They arrive only when they know you are tired and sleepy. :) – Charles Clarkson Aug 21 '13 at 14:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.