0
我已經在WordPress安裝了一個自定義圖片庫,並且我想在其中一個頁腳框中顯示它們有多少個?我嘗試了很多,但這是唯一的代碼實際顯示的結果,但它的錯誤!試圖獲得自定義廚房中的圖像總數?
<?php
$numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish'");
if (0 < $numposts) $numposts = number_format($numposts);
echo 'We have published '.$numposts.' since our launch.';
?>
想要計算行嗎?使用'mysql_num_rows' –
我只想顯示圖庫中有多少圖像,因此它會顯示「圖庫中的92圖像」exc, –
那麼你有mysql數據庫,它們有必須顯示爲圖庫的圖像鏈接? –