Multiple cat widget not updating blog


#1

I chose the GreatMag Multiple Cat post widget to my Blog page, specifically so I could leave out one category (Recipes) since it has it’s own page.
https://valenciaporter.com/blog/

However, the blog page is not reflecting the updates to the blog page. I’ve had this issue on more than one site in which I use GreatMag.

I purged the cache but nothing changed.

Also, when I edit the BLOG page, and click PREVIEW, it takes me to the homepage. The BLOG page is set up correctly, and not to the HOMEPAGE.

Please advise. Thank you!


#2

Hello there,

A page that’s assigned for posts index page, it instantly loads different template. This is a special template which resides in the WordPress core system – it only loads list of posts. You should have had a separate page and use the same widget settings as in your screenshot.

Regards,
Kharis


#3

Isn’t that what this is?


#4

Yes. Correct. The page marked as “Posts Page” is no longer a regular page. Any content made in its editor box won’t take any effect because it uses a special template, which resides in the core system.

Regards,
Kharis


#5

I now understand, but perhaps what you can help me with is that I just want to have the blog page as is, minus one category of posts from the RECIPES category, since it has it’s own page, and thus would be redundant on the blog page.
Is there code that I can use to do this, please?

Thank you!


#6

The reason I ask is because a Blog Filter plug in does not work with your theme.
Thanks again!


#7

Hello there,

To exclude posts under specific category, you could use the below snippet:

function greatmag_child_exclude_category($query) {
  if ( !is_admin() && $query->is_home() && $query->is_main_query() ) {
    $exclude_cat    = array();
    $exclude_cat[]  = 2; // Category ID 2
    $query->set('category__not_in', $exclude_cat);
  }
}
add_action('pre_get_posts','greatmag_child_exclude_category');

Define the ID number of post’s category in this line:

$exclude_cat[]  = 2; // Category ID 2

The category ID is hidden by default. To display it, you can use this plugin.

To apply the code snippet above to your site, you could use the child theme’s functions.php file. Or use a plugin that allows functions addition, like Functionality.

Regards,
Kharis