嘗試使用我制作的這個函式時,我收到了一個意外的 t_string。我知道我一定在這里遺漏了一些東西。
function get_top_terms(){
global $wpdb;
$termsSQL = "SELECT DISTINCT AN_terms.name from AN_posts INNER JOIN AN_term_relationships on AN_term_relationships.object_id = AN_posts.ID INNER JOIN AN_term_taxonomy on AN_term_taxonomy.term_taxonomy_id=AN_term_relationships.term_taxonomy_id INNER JOIN AN_terms on AN_term_taxonomy.term_id=AN_terms.term_id where AN_posts.post_date_gmt >= NOW() - INTERVAL 1 DAY and AN_term_taxonomy.taxonomy = "post_tag" group by AN_terms.name order by count DESC limit 5";
$tResults = $wpdb->get_results($termsSQL);
print_r($tResults);
}
add_shortcode ( 'topTerms', 'get_top_terms');
uj5u.com熱心網友回復:
試試這個
function get_top_terms(){
global $wpdb;
$termsSQL = "SELECT DISTINCT AN_terms.name from AN_posts INNER JOIN AN_term_relationships on AN_term_relationships.object_id = AN_posts.ID INNER JOIN AN_term_taxonomy on AN_term_taxonomy.term_taxonomy_id=AN_term_relationships.term_taxonomy_id INNER JOIN AN_terms on AN_term_taxonomy.term_id=AN_terms.term_id where AN_posts.post_date_gmt >= NOW() - INTERVAL 1 DAY and AN_term_taxonomy.taxonomy ='post_tag' group by AN_terms.name order by count DESC limit 5";
$tResults = $wpdb->get_results($termsSQL);
print_r($tResults);
}
add_shortcode ( 'topTerms', 'get_top_terms');
出現一個簡單的語法錯誤。
我剛剛更改了“post_tag”部分
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/511124.html
上一篇:keepalived高可用
