Newsfeed Page

Hey there.

I am running my website on the church demo. At the bottom of the demo is a latest news section. only posts with the category “news” get displayed. by clicking on one post i get a new page with the post and a sidebar on the right just like my blog page. my question is. i would like to add a “news” page to my top menu. so if i click on a post on the homepage it’ll take me to this page to see all posts with category “news”. is that somehow possible? what would be the best way to do that?

Hello @joziguy,

That’s definitely possible. All you need to do is add Relevant Category as a menu item from Appearance > Menus. Once you add News category as menu item, it will display articles that are assigned under News category. https://screencast.com/t/TajlapvlMLF

Thanks.

it worked thank you. Now that i see how it works i would like to know if there is a way that posts with category news only appear on the news page. right now when i open a post on the news page it links me to my blog page where the post with category news also appears…any way to stop them from being displayed in my blog grid?

Hi there,

It sounds like you have set the news page as your post page in Settings > Reading > Post Page.

If that’s the case, all the post or blog items will be displayed on that page regardless of their category.

If you want to have a specific page for the news, you can create a category for news and set the articles there and do the previous suggestion by @Prasant.

Hope this helps.

hey, that’s what i did. my post page is the blog page. i have then added category “news” and added it to my menu. basically what i want is TWO post pages. one for the blog and one for news. both should be completeley independed.

Hi there,

The method you used for the menu item should only show the News Category if it shows otherwise we need to take a look on your installation to make sure how you set things up and give you advise.

Kindly, get back to us with the URL/User/Pass of your website using the Secure Note functionality of the post to follow up the case.

Please consider that this is not a theme related stuff and purely related to the WordPress usage itself. I did a google search and found this video which can help you get this done quickly:

Thank you.

Secure note

Hello There,

Thank you for the clarifications. I have logged in an edited your page. I made necessary changes to achieve what you want to achieve. Here are the things I’ve done:
1.) I edited the page back in Cornerstone and find the Latest Post section.
2.) I duplicated the row so that they will have the same layout. http://prntscr.com/hc9xqi
3.) I edited the button, change the text to “All News” and changed the link url too. http://prntscr.com/hc9yln
4.) I edited the recent post elements and an added a category filter so that only blog or news will display in each corresponding element. http://prntscr.com/hc9y9v, http://prntscr.com/hc9ye6
5.) I have installed a child theme first because the final change will need a little modification so that “News” categroy will be excluded in your blog index. I am basing this solution from this thread:
https://theme.co/apex/forum/t/excluding-category-from-blog/6242

6.) I added a custom php code in your child theme’s functions.php file as mentioned in #5.

// Exclude News category in blog index 
// =============================================================================
function x_exclude_cat_from_blog($query) {
  if ( $query->is_home() && $query->is_main_query() ) {
    $query->set('cat', '-14');
  }
}
add_action('pre_get_posts', 'x_exclude_cat_from_blog');
// ============================================================================= 

14 is the category ID of NEWS and it is negated so that it will be excluded.

Please check your site now.

alright thank you for your work. here is what i found.

  1. for some reason my homepage was set on default page which is why i all of a sudden i had a sidebar and landmark and posts on it. so it looked like a blod page. i set it back to no container, footer, header.

  2. when i click on the button all news it opens on my news page. that works. but when i click on a single post on the news page it still opens up on my blog page. so guess it is still not seperated.
    the same thing happens when i click on a post in the latest news section on my home page. it also opens on blog page.

  3. the changes you made were done in the latest posts section. at the bottom of my page i have a recent news section. so i have done exactly what you did in the latest posts section in the latest news section and deleted the duplicate you made.

  4. you said you excluded categories from opening on one of the pages. so blog is excluded from opening on news and vice versa. does it matter wheater i set the category for a blog post “blog” as primary? or can i set categories like “how to…” and “blog” for a blog post and how to is the primary cat?

  5. i cleared cache a couple of times and tried again but the pages still dont seperate…

what can i do?

edit: i really dont know whats happening to my site. i am busy editing and all of a sudden my portfolio page looks like a blog page and is set on default template. the same thing happened to my homepage an hour ago. now other changes that have been done also disappeared…

Hi There,

1.) I am not sure about the changes, but you have change it back.

2.) Can you clarify your expectation here? The code added by @RueNel will only remove all posts under NEWS category from the display on default index blog page. But how it works on single post pages, regardless of categories will still be the same. That is the default structure of wordpress. There’s blog index page and there’s category pages. At the moment, I am not sure what you meant by it also opens on blog page.

4.) and 5.)The code provided on #6 will only work on blog index page here: http://patricklemmer.com/blog/. It exclude NEWS category from display.
By default, category pages like http://patricklemmer.com/category/news/ will only display post with that specific category. We don’t need any custom code to hide other post not included here.
For recent post element, like on your homepage, category will define what is included. It will display all post by default (maximum 4) but we can filter it to display post under specific or multiple categories as defined.

Now, what do you expect with primary cat here? You can add how to, blog or any other categories and it will display anyway by default on blog index page here: http://patricklemmer.com/blog/

For portfolio, how was it before? Are you using Layout portfolio? After checking, I can see you have edited portfolio page using Cornerstone builder. If in case you are set to use Layout Portfolio, the page content will use the template to list portfolio items and builder is not necessary. Please also clarify the changes that has been disappeared. Thank you.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.