If News is a category of posts, then:
- First, find out the category ID, login to wp-admin, go Posts->Categories, mouse over the ‘News’ category, and cat id should be shown under the left corner of the browser (for chrome this works, not sure about other browsers).
-
Add the following code into your function.php
function my_news_category( $query ) { if ( $query->is_frontpage() && $query->is_main_query() ) { $query->set( 'cat', '18'); //remember change this to the actual cat id } } add_action( 'pre_get_posts', 'my_news_category' );
For this solution, you don’t have to change the underscore template at all.
Alternate solution would be adding query_posts()
before displaying the main loop on your frontage template as I suggested on my comment. See official documentation for more details on how to implement it.
Related Posts:
- How to get posts published between a date and today?
- Display all posts from specific categories on a page
- How to exclude latest x posts from a paginated query?
- Display content from a specific category
- Why do I need to use The Loop on pages (inside page.php etc)?
- posts page – different lengths of excerpt
- Can’t show comments count per post outside loop
- Multiple loops in same page, without duplicate content
- How to Display Post View Count
- How would I get 1 latest post from a query for 5 posts?
- Differentiate between posts and pages in search results
- page.php showing loop of posts and not page content
- Inserting custom data to the_post() during loop
- How To Get Posts With A Specific Word
- Why WP_Query(‘showposts=5’) shows only 1 post?
- Multiple loops are not reset
- Display all posts that were published before full post on single.php
- Blog post per page setting conflicting with custom WP_Query?
- How to exclude latest x posts from a paginated query?
- Two loops, one AJAX loop, exclude posts in first loop from second loop, loops are in different files
- How to order posts in an arbitrary order?
- Wrong post title displayed from loop
- Multiple Loops Breaking Pages
- Get the amount of posts on a current page
- How to get posts published on the latest date?
- How to only publish posts with image in it
- WordPress Query Posts From Category Post on Static Page
- WP_Query: Show 10 posts in date order, first three random
- Display specific posts on home page
- Display 3 posts with different HTML markup using a loop
- Pagination for normal (standard) posts on a page with a custom loop?
- Changing wp_link_pages() to “Next Page” and “Previous Page” buttons?
- posts going to 2 pages/categories only show up in 1
- How to show post views shortcode data for each post on Posts List Page?
- How to distinguish pages created by woocommerce?
- Use special template for the first post in the loop
- Posts are not showing up on next page.
- Modify WordPress loop after it has been run
- show latest authors blog post
- Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?
- Adding a category at even positions on main loop with modified pagination
- How to inject a post within a loop
- Where are my posts linked to? I keep getting a Not Found Error, and I have no single.php page
- The loop: more posts than I want to fit on one page
- Redirecting posts in WordPress to a specific page
- When and how will php code in a user made WordPress page be executed?
- What function does the loop of displaying posts?
- Why does ‘get_the_ID’ work outside of the loop?
- WordPress Post Query Using Custom native MySQL like St_Distance_Sphere
- Archive template combined with post slider and regular posts
- older blog posts not showing in new theme
- The_excerpt() doesn’t parse – how to change that?
- Trying to edit archive.php to only show post extract, with featured image
- Add Blog to WP homepage Manually
- Total number of posts in query (category/tag/author/search results/main page…)
- How can I remove the first two words and shorten get_the_title()
- How to show all posts by author on buddypress profile with navigation
- Custom Permalink Structure for Pages & Posts
- Getting a “404 Not Found” error when “Preview Changes” is clicked
- Why won’t pagination work?
- Page and post loop same template
- How to create a “latest news” page showing a list of posts from blog category
- ACF to select posts not displaying on blog page
- Add custom text automatically on each post
- Getting blog pagination to work on page set as front page
- Extracting relevant tags associated with that particular single post only
- How do you search for a post or page with a certain url on the WordPress admin panel?
- How to check in functions.php if there is data in a WP_Query?
- Shortcode with ‘year’ parameter
- Make loop inside slider divisible [closed]
- How to add some html formated text to every new post in WordPress
- How to add automatically bootstrap 4 order-lg-1 and order-lg-2 classes for columns in foreach loop based on the count?
- Why this function doesn’t works without the_post?
- Post Filtering by GET URL parameters
- On what hook can I get the queried object’s final state?
- Display current post position in Elementor Posts widget
- Intercept page request and add value to it
- wp_query with ajax
- How to give classname to post if post has no content?
- WordPress 302 Redirect to Random Product/Post/Page
- Loop through posts? Want to remove extra newlines in actual post HTML/content on backend
- Output Post with ACF Fields into other Post
- How to create a page that shows the last 10 posts?
- $_GET parametters not working in an specific template
- Get the most recently modified post date of most recently modified post
- New Posts and Pages Won’t Save
- My Custom Post Type Still Using index.php
- get_children returns older images
- Custom posts listing widget always returns 1 extra result
- How include css class based on post ( in loop ) slug?
- Posts and Pages: 404 Page not found
- Get post by tag
- WordPress Loop: How to display recent posts in multiple divs
- Random posts that always include a particular post?
- Querying another post category to match current post and display in loop
- WordPress post filter menu
- How to display posts on custom page without declaring a posts page in reading settings?
- the_content() Not Grabbing All Content
- Show posts by quarter
- Display Featured Posts Grid on Static Page (Gazette)