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
- How to get Images included in Post
- How to know if get_posts() failed?
- Template file for static posts page does not get loaded?
- How do I sort (order) the results from `get_children()`?
- How can I display 7 posts on the home page, but 9 posts on the subsequent pages?
- 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]
- How to enqueue scripts depending on post formats?
- Linking to page with all posts
- How to Replace the WordPress Featured Image with a Video?
- 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
- How to load a different header based on post format?
- 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?
- Understand post type
- 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
- Why orderby=”date” does not support manually changed posts?
- Limit posts per author role (excluding admin) in home page
- I am unable to publish/update post
- page.php showing loop of posts and not page content
- 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 single post page as home page
- How to show last post of each website of a MU wordpress in HomePage
- Exclude category from
- Blog page not working
- Move first half of posts to one parent page, second half to the other page
- How to display the link (title) and thumbnail post?
- Underscores Theme Unit Testing – Catching Untitled Posts
- 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
- Unable to restore from backup – how to obtain old blog posts?
- 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
- What does WordPress do if I save a post without content/title? [duplicate]
- How to add a class to edit_post_link?
- 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?
- Single Post in Tab/Slider
- 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
- Custom home page with full post for first one only
- 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?
- Inserting an example of the last 3 post on to the homepage
- I don’t want the complete article to show on homepage
- Cant’ Grab WordPress Built-in Posts Through Loop
- Post is in descendant category not working in home.php
- 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)
- I can’t find the relevant part of the loop in my theme file. How do I find the full content with “More…”
- 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
- Permanently deleted posts still exist
- created post displaying differently on front end
- “Blog pages show at most” in setting not working
- Why is WordPress showing a blank excerpt for just one of my posts?
- 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 featured images disappeared on my homepage
- Blog images not showing on homepage