Query the title of the page to show posts with matching category in the loop
you don’t need to echo the title out. Try this: $the_query = new WP_Query( array( ‘category_name’ => get_the_title() );
you don’t need to echo the title out. Try this: $the_query = new WP_Query( array( ‘category_name’ => get_the_title() );
$id isn’t set anywhere in your code snippet. get_the_title( null ); returns an empty string. If you want the title of a post, you’ll need to set $id to a proper post ID. (Also, $args) is unset in the code you’ve posted, and I don’t see anywhere that you use query_contents either.)
By giving each role the edit_others_posts capability, plus allowing each role to edit only one CPT, you actually getting what you want. no need to check anything about other users capabilities this way. Maybe what you’re missing is having a different capability set for each post type. e.g: if you have CPT called books you … Read more
under settings – reading, set ‘blog pages show at most’ to 8 then use conditional statements based on the current post number in the loop; <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <?php //conditionally outputting the opening tags for the first section if( $wp_query->current_post == 0 ) { ?> <div class=”posts-wrap”> … Read more
Your taxonomy Query is worng. please try something like that: $args = array( ‘post_type’ => ‘contact’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘abteilung’, ‘field’ => ‘term_id’, ‘terms’ => ’29’, ), ), );
Can I show some specific post rather than latest post?
You can’t. wordpress pagination API is designed to work with the main query and not with a secondary one as in your case. There are many answers to similar questions around here with a all kinds of hacks to go around it, and while applying enough hacks, might make it work for your specific case, … Read more
global $switched; switch_to_blog(2); //switched to your site id based on which site post need. $administrators = get_users( array( ‘role’ => ‘administrator’ ) ); // you can add more role on same query add with “,” separated. $administrators_ids = array(); $original_blog_id = get_current_blog_id(); foreach( $administrators as $admin ): $administrators_ids[] = $admin->ID; $news = new WP_Query( array( … Read more
You could try this: $args = array(“post_type” => “mytype”, “s” => $title, ‘post_status => array(‘draft’)); $posts = get_posts( $args );
Group Custom Posts Types in a Relation field of ACF