getting content from main domain to sub-domain using category and WP_Query

What you can do is to set up a pre_get_posts() filter in the subdomains’ theme functions.php file to restrict posts to the desired category… function my_subdomain_category( $query ) { if ( $query->is_main_query() ) { $query->set( ‘cat’, ‘123’ ); // use the categoryID for space or products } } add_action( ‘pre_get_posts’, ‘my_subdomain_category’ );

Include posts from feature category in pre_get_posts

I haven’t run this code so there may be a syntax error, but the gist is to return userfeed-taxonomy with the terms specified that have featured category OR cities-taxonomy with the terms specified and featured category OR anything else that’s not those taxonomies. It’s kind of clunky, maybe there is a better way: $query->set( ‘tax_query’, … Read more

Pagination Not Working on Category.php page

Try this code, not much different from your’s but with proper nesting. Let me know if that works. <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <article id=”post-<?php the_ID(); ?>” <?php post_class(); ?>> <a href=”https://wordpress.stackexchange.com/questions/212425/<?php the_permalink() ?>” class=”noborder”><?php if ( has_post_thumbnail() ) { the_post_thumbnail(‘thumbnail’); } ?></a> <a href=”<?php the_permalink(); ?>” … Read more

Show only one category

CHRISTMAS EDITION Due to Christmas time and my brain hitting some serious technical difficulties, I got get_the_category() and get_the_categories filter mixed up. Here is the revised filter function, working: You can also make use of the get_the_categories filter add_filter( ‘get_the_categories’, function ( $categories ) { // Only return the first object in the array return … Read more

Sorting posts by season

Probably the most “WordPress-y” approach to such a problem is to store the date of your ‘event’ custom post-type in the post’s metadata. Enabling users to set meta-data on a post is usually accomplished by using the ‘register_meta_box_cb’ argument to the register_post_type() function to add an extra “meta box” interface to the pages for creating … Read more