【发布时间】:2017-12-15 06:33:43
【问题描述】:
我正在尝试使用以下代码以逗号分隔值显示最后几个帖子标题。这里我从 wp_post 表中进行查询。现在我如何在此代码中获取类别,因为没有列category 在wp_posttable 中。下面是我的代码
<?php
$posts = $wpdb->get_col("
SELECT $wpdb->posts.*
FROM $wpdb->posts
WHERE post_status = 'publish'
and post_type='post'
ORDER BY post_date DESC LIMIT 10");
$the_posts = array();
foreach($posts as $post) :
echo implode( ', ', $the_posts );
?>
【问题讨论】:
-
csv 在哪里?
标签: php mysql wordpress categories