Random taxonomy category list

There is no default way to sort terms randomly. There are ways to do this using php. First, you’ll need to remove the number argument from get_terms. As your code currently stands, you are getting 5 terms and shuffling them around. For this to work, you’ll need to retrieve all the terms from your taxonomy, … Read more

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