How to print TablePress content?
-
Tobias,
I’ve created new topic (I hope it is ok). I was thinking how to solve the link chcecker (to not copy all the time manually the HTML into draft). So maybe I will generate it automatically using tamplate with PHP code in draft page? Anybody know better solution? More effective or faster PHP code for that? Here it mine so far (however there is problem with spacial Polish characters starting with \u):
<?php // first need find out which entries in wp_posts are the correct ones // so we have to get correct IDs $TP_options = get_option("tablepress_tables"); // looks not friendly print($TP_options); print("<br/>"); $TP_options = str_replace("}","",$TP_options); $TP_options = str_replace("{","",$TP_options); $TP_options = str_replace("\"table_post\":","",$TP_options); // now little better print($TP_options); print("<br/>"); // however need to now how many IDs (tables are there) $TP_options = explode(",",$TP_options); $TP_length = explode(":",$TP_options[0]); $TP_length = $TP_length[1]; // so far we know how many tables there are print($TP_length); print("<br/>"); // so lets get IDs $TP_IDs = array(); for ($i = 1; $i <= $TP_length; $i++) { $TP_IDs[$i] = explode(":",$TP_options[$i]); $TP_IDs[$i] = $TP_IDs[$i][1]; // so we have correct ID print("<br/><br/>"); print("<b>".$TP_IDs[$i]."</b>"); print("<br/>"); // now we have to get content for that ID $queried_post = get_post($TP_IDs[$i]); $TP_content = $queried_post->post_content; // well it looks not so good $TP_content = str_replace("kkstarratings","<br/>",$TP_content); $TP_content = str_replace("div","span",$TP_content); $TP_content = str_replace("[","",$TP_content); $TP_content = str_replace("]","",$TP_content); $TP_content = str_replace('\\"','',$TP_content); $TP_content = str_replace("\\t","",$TP_content); $TP_content = str_replace('"',"",$TP_content); $TP_content = str_replace(","," ",$TP_content); $TP_content = str_replace("\\/","/",$TP_content); // now little better $TP_content = apply_filters('the_content', $TP_content); // lets show it print($TP_content); } ?>
Regards,
Darek
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘How to print TablePress content?’ is closed to new replies.