I make a plugin that returns a table with data. Sample code:

function text_print(){ $data = some_data(); echo " <table > <tr> <th></th> <th></th> <th ></th> <th ></th> </tr> <tr> <td > $data </td> <td ></td> <td ></td> <td ></td> </tr> </table> "; } function data(){ return "something text jnjnm "; } 

In php, everything works as it should - the data is displayed in the table cell. After inserting the function in the plugin and running on WordPress - the text displays above the table.

    1 answer 1

    Decision

     function text_print(){ $data = data(); return " <table > <tr> <th></th> <th></th> <th ></th> <th ></th> </tr> <tr> <td >".$data."</td> <td ></td> <td ></td> <td ></td> </tr> </table> "; } function data(){ return "something text jnjnm "; } 

    In all functions, returning values ​​using return will then not return the data (variables, functions) above everything.