IT Nursery
This code works perfectly function exclude_category( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $query->set( 'cat', '-1' ); } } add_action( 'pre_get_posts', 'exclude_category' ); But this code...
  • June 3, 2022
  • 0 Comments
IT Nursery
I have two loops in archive.php, both are affected by pre_get_post. My code on pre_get_post is this: // My pre_get_post function my_pre_get_posts( $query ) { if ( is_admin() ||...
  • June 1, 2022
  • 0 Comments
IT Nursery
I have created a filter to skip first post of the archive on “podcast” category. Below is the code. add_filter( 'pre_get_posts', 'amd_limit_posts'); function amd_limit_posts($query){ if (is_category('podcast')){ $query->set('posts_per_page', 4); $query->set('offset',...
  • June 1, 2022
  • 0 Comments
IT Nursery
I want that my search page give results of posts (that i want that show) and taxonomy The code to get just two type of posts: function searchfilter($query) {...
  • June 1, 2022
  • 0 Comments
IT Nursery
My understanding is, that custom post types can share tags with the posts also. I have created tags and applied them to a blog post and a custom post...
  • May 30, 2022
  • 0 Comments