Jump to content

smizmar

New Members
  • Posts

    2
  • Joined

  • Last visited

smizmar's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Nope, that was the first thing I've tried. No error message, but the result is an empty page :-( Thanks for your reply though! :-)
  2. This must be easy enough, but I'm a noob so go easy on me, please :-) I have two pieces of code and they're working well on their own. All I need is to put these two conditions into one query. The first one: <?php function childtheme_cat_limited_blog( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $query->set( 'events_categories', 'mycategory1' ); } } add_action( 'pre_get_posts', 'childtheme_cat_limited_blog' ); ?> And the second: <?php function childtheme_cat_limited_blog( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $query->set( 'category_name', 'mycategory2' ); } } add_action( 'pre_get_posts', 'childtheme_cat_limited_blog' ); ?> I'm sure it's a piece a cake for you guys, but I can't figure it out for the life of me, so any help would be greatly appreciated! Thank you! (My goal is here to display posts from two categories on a homepage of a Wordpress site, but to complicate things the two categories are from two different post types.)
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.