我使用的是GD星级插件,我有一个功能,可以输出排名靠前的帖子。问题是:它不会显示这些帖子的内容或摘录。我该怎么做?这是我正在使用的函数:
<?php
global $wpdb; // include the $wpdb
$query= "SELECT p.ID, p.post_title as title, visitor_votes + user_votes as total_votes, visitor_votes, user_votes FROM `".$wpdb->prefix."gdsr_data_article` da INNER JOIN $wpdb->posts p ON da.post_id = p.ID order by total_votes desc limit 20";
$results=$wpdb->get_results($query); // run the query on the database
if ($results) { // if we have any results
?>
<table><thead><tr><th>Position</th><th>Post</th><th>Points</th></tr></thead>
<?php
$position=0; // we set the position as 0, as we start every loop with increasing it by one
foreach ($results as $toppost) {
$position++; // see, I told you, we increase by one, so the first post will get position #1
echo "<tr><td>#".$plads."</td><td><a href=\'".get_permalink($toppost->ID)."\'>".$toppost->title."</td><td>".round($toppost->total_votes)."</td></tr>";
}
?>
</table>
<?php
}
?>
我已经试过了:
get_the_excerpt($toppost->title)
和
get_the_excerpt($toppost->ID)
, 但他们都没有表现出来。