So this is the code I have on one of my Website inside the footer, this basically get’s the 3 latest posts and displays the_title
you can change this to show the_excerpt
.
<?php // news posts loop begins here
$newsPosts = new WP_Query('page=blog&posts_per_page=3');
if ($newsPosts->have_posts()) :
while ($newsPosts->have_posts()) : $newsPosts->the_post(); ?>
<!-- Blogs -->
<div class="post-item">
<!-- This is where you can insert the excerpt -->
<h4><a href="https://wordpress.stackexchange.com/questions/215718/<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
</div>
<!-- ./Blogs -->
<?php endwhile;
else :
// fallback no content message here
endif;
wp_reset_postdata();
?>
Related Posts:
- how to display full post with pagination on home page
- Displaying Page Title on index.php
- Keep featured content post in homepage with original order
- Template file for static posts page does not get loaded?
- How do I sort (order) the results from `get_children()`?
- Post & edit a post from front end along with upload, dropdown, and other inputs
- How do I change the gallery that is inserted in the post?
- How can I specify a category post on my home page
- Hide parts of the post content on the home page
- Show post titles only on the homepage
- Posts Page Featured Image [closed]
- Linking to page with all posts
- How to link up “read more” on excerpts hack from WP Recipies
- Adding “latest from the blog” to the homepage
- Convert a complex webpage into WP theme
- Changing next and previous post link text
- Can I set and show “important” post in my blog?
- How can I remove posts of a certain category from homepage after a specified time period?
- Mark menu item as current-menu-item for category
- Understanding and using metaboxes in posts
- Why won’t my taxonomy query show up?
- How to make the post summary taller?
- Admin Notices don’t display on the admin screen for certain post
- Limit posts per author role (excluding admin) in home page
- I am unable to publish/update post
- Custom WordPress Theme: Publish Date and Display Date for posts right beside each other
- Properly display posts on homepage
- Best way to assign post position in a news site homepage? (no categories, no sticky posts)
- How to show last post of each website of a MU wordpress in HomePage
- Exclude category from
- Blog page not working
- get_the_excerpt() is not working as expected – returns wrong text
- How to use format post in a pertinent way
- How do I display some posts fully on the homepage, and some as an excerpt only?
- Editing the default page to show all posts, rather than most recent ones
- Disable sticky option for specific categories
- Highlight static blog page link in header
- How to create a template for Pages?
- How do I do a page break?
- Hide posts belongs to few categories in homepage
- What file is the standard frontpage that lists all the posts?
- Block editors annoying warnings
- How to Use index.php file for “Blog” Page And this is Not a Home Page
- Loop doesn’t exclude the specified category in home page
- Admin – no Featured image choice in create new/page|post
- Is there a way to create a meta box that can be added multiple times to a post dynamically?
- Getting Duplicate Posts on Home Page with Widget Added Between Posts
- how to hide empty fields of post category description?
- Add hero image to home page (blog format) via the dashboard
- Give posts a particular template based on the assigned category
- Display Featured Posts Grid on Static Page (Gazette)
- how to handle the loop using filling bootstrap grid structure?
- I don’t want the complete article to show on homepage
- Change default post style to columns
- links to posts not working on homepage
- How do I allow certain users to make a certain type of post?
- How to add a post class on every post. (on homepage)
- how many visitor open this post? [closed]
- What’s a theme that properly handles previews of different types of posts?
- WordPress Architecture as a CMS – Posts & Pages
- Conditionally exclude post from specific category on home page sidebar?
- Am getting duplicate data from get_posts()
- Change modified date to current date when title updated automatically
- Add a field in my rest api
- created post displaying differently on front end
- “Blog pages show at most” in setting not working
- Aligning images in the wp editor not working. How do i get this to work in custom theme?
- How to pull latest posts from a specific category
- How to show only homepage in google results instead of privacy, contact pages
- Problem paginating a subquery on a post
- Include Recent Post in Category
- How to Make my Homepage Display a Single Specific Post?
- Make current post the homepage
- Moved a website and excerpts don’t work for old posts
- Blog images not showing on homepage
- How to get value of a selected option from select tag and use it in WP_query to filter posts?
- Integrate video and iframe in a post type gallery
- How to put the WordPress blog into theme
- Display post order ranking within wordpress loop
- Displaying a specific sub-category’s posts from wp_query
- Posts only showing on /localhost/wordpress/ and not on other pages
- Post are not showing up
- How to remove related post from home page
- Post as frontpage – avoid duplicate content
- Blog styling in SASS
- How to show the posts list into a static page? Problems to use the loop into a static page
- WP Load post with ajax and apply isotope
- 404 error on every post and page other than home
- Display the current post author and his url in the post header
- Trying to display stick or featured post on homepage
- wordpress taxonomy results
- Get most recent posts by category that aren’t first overall [duplicate]
- How to show only the date, the title and a little “summary” of my WordPress post in my custom theme?
- How to have more post in a page than in your home page
- Convert HTML5 to WordPress theme
- Wp_query WooCommerce products
- Get posts after calculating meta key
- No matching template found when using single.php
- Display content from specific category
- WordPress Ajax load doesn’t work