Monday, 26 August 2013

Table appears in Visual mode of editor but not in preview or after publish

Table appears in Visual mode of editor but not in preview or after publish

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.

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>
<?php
// 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);
$results_desc;
if(!empty($results_f)){
$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] != ' ') {
$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.

No comments:

Post a Comment