0

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...

2
  • Please post some of the code that you have tried.
    – Flimm
    Oct 10 '17 at 9:27
  • portfolio posts are mostly maintained like custom post types, it depends on theme you are using.. Oct 10 '17 at 11:38
1

You 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:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.