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:
Related Posts:
- Where is the old post permalink slug stored?
- Keyboard shortcut for updating a page or post?
- How to Change Order of Posts in Admin?
- get all posts ID from a category
- Manipulate post category after time
- Categories box not showing on post edit pages
- how to enable different number of revisions for different blogs when using WPMU?
- Removing the title attribute from links in the post content
- Some posts returning 404 instead of displaying post
- How to enqueue scripts depending on post formats?
- Custom function for “Submit for Review” hook
- If specific user role then sticky post
- How to add a custom field after wp post
- Link post permalinks to subdirectory /post
- Submitting POST data to a custom page template triggers a 404, why?
- How do I add a custom body class to the admin area of a page?
- How to prevent WordPress from updating the modified time?
- Custom WP_QUERY $args
- Dynamic carousel on individual posts
- Can’t get the_content of the parent page from its single post?
- How do I Show ALL posts for Catagories and Tags?
- Get the most repeated post contents from a search?
- Prepend or add an Image to the content of a Post
- Remove all links in post content
- pre_get_posts query between 2 dates (date stored in custom post meta)
- Classic editor throws 403 error based on post content
- How to build a site with a map that shows where people offer and need help?
- I get this error message when I try to add a module to a course on my website using Sensei plugin
- Post categories to pages
- Publish post’s date is set to Nov 30 -0001
- WP_Query: Mixing category__in and tag__in together
- Fix existing media names with accents
- Any way for get_next_post() to use the actual post order instead of publish order?
- How to display excerpt post on hamepage and archive pages?
- Worpdress function for difference dates
- Get all comments of author’s posts
- Problems with Page Not Found
- Send a review notification email to admin when a post is 12 months old
- Get posts and include taxonomy term
- Adding bootstrap classes to video shortcodes
- Two Custom Post Types with Identical Articles Competing for the same Slug
- Single Post in Tab/Slider
- get_posts from a category id doesn’t work
- Change page creation layout
- Get post number both in the loop and in the post
- posts_per_page returning only one post
- Database hacked – random posts are modified
- Display value of custom field at the beginning of a post
- How to display post list in a table layout (multiple queries in single loop)
- Get current post’s nav menu name (term name)
- Get latest author posts inside the loop
- Post is in descendant category not working in home.php
- How to show 3 most recent/viewed posts in a special tiles on home page using wordpress?
- Get content from WordPress posts in Boostrap modal window – Javascript side?
- Approve modified posts
- How to repeat a loop after 4 posts [duplicate]
- How to show beneath posts the full category path?
- User friendly news section in WordPress without using posts
- How to assign a post to a post parrent?
- AWS usage queries
- Bulk update published posts date randomly using wp-cli?
- How to insert custom text after H1 to all my blog posts?
- Hook when post is set from published to draft?
- Use posts from old db by changing prefix
- SQL query: select duplicate posts – but using duplicate meta [duplicate]
- Sync All Post Type Tag
- ‘posts’ table should not store the absolute image path
- How to make a page show posts only from specific categories without editing php files
- Assign a day of the week to post, e.g: Assign Monday to post and have it only appear when the day is Monday
- Redirecting user to a page when there is no content?
- Is it possible to query a category with specified posts?
- How do I set content in my pages so that it remains permanent while blog posts are added below?
- how to redirect page after delete post inside a post page?
- Permalink base only for posts
- Add caption to thumbnails in content
- WordPress URL question
- How to retrieve a post by inputing the url in a custom field and displaying it on an options page
- Theme does not respect spaces between paragraphs in pages
- Custom fields in normal posts
- Modify WordPress loop after it has been run
- How to get next_posts_link working with a customised page
- exclude one child by id from $post->post_parent
- Ordering posts alphabetically by meta keys and title
- Loop doesn’t display posts. It displays a link to the home page instead
- Continuous listing from a custom field
- Text editor has problem with having ” in a post
- Getting posts from multiple users?
- WordPress Post Grid
- Why I getting only 1 post?
- Choose options via url
- Custom Post Type Pagination 404 Error (if paged>=2) [duplicate]
- Stripping tag from elements in post
- find view post hyperlink in PHP wordpress admin file
- Show all posts in category
- Creating a new Sortable Column in WordPress Admin
- Even/Odd every two posts
- What function does the loop of displaying posts?
- Site ‘Categories’: save an admin global setting with post metadata [closed]
- Exclude posts by date – related post
- I cannot see the pagination in /wp-admin posts page