Senin sorgu kodu şöyle bir şeye benzemeli:
// add action to check for table item
add_action('gdlr_print_item_selector', 'gdlr_league_table', 10, 2);
function gdlr_league_table($type, $settings = array()){
if($type == 'gol-krali'){
gdlr_print_league($settings);
}
}
//table item
$player_val = gdlr_lms_decode_preventslashes(get_post_meta(get_the_ID(), 'gdlr-soccer-player-settings', true));
$assists = empty($player_val)? array(): json_decode($player_val, true);
$assits2 = (string)$assists;
function gdlr_print_league($settings){
// query league table
$args['post_type'] = 'player';
$args['posts_per_page'] = (empty($settings['num-fetch']))? '5': $settings['num-fetch'];
$args['orderby'] = $assists2;
$query = new WP_Query( $args );
// getting table array
while($query->have_posts()){ $query->the_post();
$player_val = gdlr_lms_decode_preventslashes(get_post_meta(get_the_ID(), 'gdlr-soccer-player-settings', true));
$assists = empty($player_val)? array(): json_decode($player_val, true);
$table[get_the_title()]['p'] = ($assists);
}
echo '
';
if(empty($settings['style']) || $settings['style'] == 'full'){
gdlr_print_league_table($table);
}
echo '
';if(empty($settings['style']) || $settings['style'] == 'full'){
gdlr_print_league_table($table);
}
echo '
}
// table
function gdlr_print_league_table($player){
echo '
Asist | ||
---|---|---|
}