How do I display two separate taxonomy archives for two post types that share a single taxonomy?

According to the WordPress Codex archive-{post_type}.php So, in your case (depending on your naming): archive-products.php If you have a custom taxonomy archive also, then the challenge is structuring your archive to represent the proper taxonomy template. If you need to have a custom taxonomy archive, I would recommend that you use the post-type archive structure … Read more

Confusion with adding meta capabilities to a role after registering a Custom Post Type with corresponding ‘capability_type’ parameter

Have you tried defining the capabilities inside the external_roles_post_type_init() function? After the ‘capability_type’ => array(‘external_role’, ‘external_roles’), try add this ‘capabilities’ => array( ‘publish_posts’ => ‘publish_external_roles’, ‘edit_posts’ => ‘edit_external_roles’, ‘edit_others_posts’ => ‘edit_others_external_roles’, ‘delete_posts’ => ‘delete_external_roles’, ‘delete_others_posts’ => ‘delete_others_external_roles’, ‘read_private_posts’ => ‘read_private_external_roles’, ‘edit_post’ => ‘edit_external_role’, ‘delete_post’ => ‘delete_external_role’, ‘read_post’ => ‘read_external_role’, ), as another argument of the … Read more

Will a post object’s “post_name” always be equal to the “path” on non-hierarchal custom post types? (using get_page_by_path() function)

I’m not extremely familiar with the export module so what I’m suggesting may not be a fit for your needs but the answer to your stated question of “Will a post object’s post_name always be equal to the ‘path’ on non-hierarchal custom post types? (using get_page_by_path() function)” is “it depends.” 🙂 More specifically, the path … Read more

List most recent image uploads, but only for specific custom post type

Did you try adding a filter to get_posts. This isn’t tested, just a thought after a bit of searching : function my_filter( $query ) { if( is_home() ) //Example, if u want to display recent images on home { $query->set( ‘post_type’, array( ‘attachment’, ‘my_cpt’ ) ); } } add_filter( ‘pre_get_posts’, ‘my_filter’ ); EDIT : After … Read more

Show all sticky posts, WITH pagination

Based on this post, i did this test and go it working: $sticky = get_option( ‘sticky_posts’ ); $ppp = get_option(‘posts_per_page’); if (!is_paged()) { $custom_offset = 0; } else { $custom_offset = $ppp*($paged-1); } $args = array( ‘numberposts’ => $ppp, ‘offset’ => $custom_offset, ‘post__in’ => $sticky ); $posts_data = get_posts( $args ); $pd = count( $posts_data … Read more