Answer the question
In order to leave comments, you need to log in
How to make Wordpress shortcode not ignore insertion point?
I'm trying to insert this shortcode into a post:
add_shortcode( 'top10' , 'top10' );
function top10(){
global $wpdb;
$world_table = $wpdb->get_results( "SELECT * FROM subjects WHERE isCountry = 1 ORDER BY conf DESC LIMIT 0,10" );
foreach ( $world_table as $item ) {
echo " $item->subject - $item-> conf ";
}}
Answer the question
In order to leave comments, you need to log in
$content = '';
foreach ( $world_table as $item ) {
$content .= " {$item->subject} - {$item->conf} ";
}
return $content;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question