Reputation: 117
I am learning to write a WordPress short code.
In my function I created a big table and some CSS. When I put my short code into posts, the position of the table is always on the top of the posts, regardless of where I put the code in the editor.
How can I fix this?
Upvotes: 0
Views: 85
Reputation: 9317
Shortcode content should be return. not echo. user below:
function shortcodetest(){
return "<table><tr><td>test</td></tr></table>";
}
add_shortcode("shortcode","shortcodetest");
Do not use echo :
function shortcodetest(){
echo "<table><tr><td>test</td></tr></table>";
}
add_shortcode("shortcode","shortcodetest");
Upvotes: 1