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?
- Should we trust the post globals?
- how to limit edit_form_after_title hook to page and post edit only?
- Change WordPress post-state in Admin Area
- How to have different content in the loop and single
- Only display posts with comments
- how to show all post in my page-grid.php template page
- Display Latest Post from all Categories
- How to show post(excerpt) from specific category on wp page?
- WP Query – duplicated posts once including tags in search results
- wp_tag_cloud() and the_taxonomies() work but not the_tag()
- Show all posts in sidebar in single.php
- Split WordPress Latest Posts in Multiple Columns and Rows with one single loop [closed]
- Avoid duplicate post from same Taxonomy
- Alternate row and columns every X posts
- Can I divide the pages into categories?
- How do I get blog posts to appear within CMS?
- Drag posts and pages so you can sort them in order
- Category Foreach keeps looping?
- Posts will not display on page-mypage.php
- Using wp_list_pages() after calling query_posts()
- “about us”, ” contact” sections should be article(post) or page in the simple small Business website?
- disable Tab post on nav-menus page (Admin)
- Second get_permalink inside loop points to wrong URL
- Use Click Image to Play Youtube Video in a WordPress Loop
- Why this function doesn’t works without the_post?
- Show posts by quarter
- Make ‘blog’ page show content as well as posts underneath it
- Setting limit to posts or page creation
- Using Posts Like a Page
- post/page content
- WordPress Architecture as a CMS – Posts & Pages
- Is it to possible to insert a page in the post depending on the category ofthe post
- How can I add a page that shows posts from a single category?
- Current post categories and subcatecories outside of the loop
- Numbered Pagination Showing The Same Posts After Altering WP_Query
- “read more” redirects to the wrong page
- Disable pagination in posts and pages
- Manipulate query to show specific post
- Display the latest post from some selected authors
- Add custom class to existing menu items from custom meta
- get “read more” with custom DB query like you would with WP Query
- Allow users to create their own page/s
- How to use extract shortcode in loop?
- Make Show Notes for Individual Podcast Episodes Easy to Find (multiple URL’s?)
- Get part of a page url
- Displaying posts on Homepage
- WordPress posts loop pagination – first page return 125 posts instead of 10 and the rest return 10
- The post order is different for logged-in and non-logged-in users? [closed]
- WordPress “Posts Page” isn’t showing template dropdown
- Adding Count Post in Page
- Custom post order returning posts from other categories
- change page name on page list
- CSS code for “inserting a custom post divider” after each post