admin管理员组文章数量:1315963
I want to show the recent posts from the portfolio. I tried display-posts plugin, I also tried catposts plugin, but all they do is they show the recent posts just from the blog and ignore the portfolio posts. As far as I understand, the portfolio is an extension to blog but for some reason, it doesn't work...
I want to show the recent posts from the portfolio. I tried display-posts plugin, I also tried catposts plugin, but all they do is they show the recent posts just from the blog and ignore the portfolio posts. As far as I understand, the portfolio is an extension to blog but for some reason, it doesn't work...
Share Improve this question asked Oct 10, 2017 at 9:15 ilyailya 11 2- Please post some of the code that you have tried. – Flimm Commented Oct 10, 2017 at 9:27
- portfolio posts are mostly maintained like custom post types, it depends on theme you are using.. – David Klhufek Commented Oct 10, 2017 at 11:38
1 Answer
Reset to default 1You can get latest post from any post type with the simple query
<?php
// Arguments
$args = array(
'post_type' => 'portfolio',
);
// The Query
$the_query = new WP_Query( $args );
// The Loop
if ( $the_query->have_posts() ) {
echo '<ul>';
while ( $the_query->have_posts() ) {
$the_query->the_post();
echo '<li>' . get_the_title() . '</li>';
}
echo '</ul>';
/* Restore original Post Data */
wp_reset_postdata();
}
Or if you want show latest portfolio posts in the widget, you can use the below plugin:
- https://wordpress/plugins/recent-posts-widget-extended/
- https://wordpress/plugins/recent-posts-widget-with-thumbnails/
- https://wordpress/plugins/flexible-posts-widget/
本文标签: Display recent posts from portfolio
版权声明:本文标题:Display recent posts from portfolio 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741996369a2410127.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论