Articles of post type

Understand post type

I am a bit lost, even after searching answers qutie everywhere.. I am creating a theme for WordPress, and I would like to have three custom post types (gallery, audio and video). So I added the support into the theme: add_theme_support( ‘post-formats’, array( ‘gallery’, ‘video’, ‘audio’ ) ); But then what? I can choose via […]

How do I make search results include ONLY pages, no posts?

I’m trying to return only pages in search results. This is working: /?s=term&post_type=post It returns only posts, no pages. But the opposite is not working: /?s=term&post_type=page This is returning pages and posts. How do I return only pages? Edit Forgot to mention, so I’m trying to allow the ability for the user to click two […]

How do I search inside specific taxonomies in WordPress

I am trying to search for posts in specific taxonomies but any time I search, I get results from all the other pages instead of WordPress searching within the selected category in the taxonomy. I named my taxonomy: “publication_categories”. It contains all categories for a custom post type which I named “publication”. This is the […]

Use get_post_types to query only custom posts types

I need to query only custom posts types – that is all post types in my WP install excluding posts and pages. I have used get_post_types to build a string of all custom post types which I want to query: $args=array( ‘public’ => true, ‘exclude_from_search’ => false, ‘_builtin’ => false ); $output = ‘names’; // […]

wp_list_filter() and supports

I’m testing the function wp_list_filter(), basically I want to know if post_type has some specific feature before making stuffs. So I end up with this: public static function get_post_types_with_support( $feature ) { global $_wp_post_type_features; $post_types = wp_list_filter( $_wp_post_type_features, array( $feature => 1 ) ); return $post_types; } The problem is I do not understand why […]

custom post types don't appear in RSS

I created custom post-types in my site but these posts are not shown in the RSS. Only the regular posts appear there. What could be preventing them from showing up there

Show all parents and children in custom post type in right order

I would like to show all posts from a custom post type on one page with the ordering exactly like in the backend. I get the right ordering with wp_list_pages, but of course without the content. parent 1.1-> sibling 1.2-> sibling parent 2.2-> sibling… etc. But I cant figure out how to set the order […]

wp_query for displaying attachments with a tag

So I am running the following query: <?php $args = new WP_Query(array( ‘post_type’ => ‘attachment’, ‘posts_per_page’ => -1, ‘oderby’ => ‘title’, ‘order’ => ‘ASC’, ‘post_status’ => ‘any’, ‘post_parent’ => null, ‘tax_query’ => array( array( ‘taxonomy’ => ‘post_tag’, ‘field’ => ‘slug’, ‘terms’ => ‘logo’ ) ) )); while ( $args->have_posts() ) : $args->the_post(); ?> An issue […]

Is it possible to request several post types from a feed?

If so, how should the query URL be formatted? I’ve tried: post_type=cat1&post_type=cat2 post_type=cat1,cat2 post_type=cat1+cat2 This bug report says you could use post_type[]=cat1&post_type[]=cat2 if not for the fact that “all request parameters are converted to strings”. Is this still the case and what does it mean?

Adding a term name from a custom taxonomy assigned to a post link displayed by a wp_query loop based on another taxonomy

I have registered a custom post type “Animals” and also two custom taxonomies (“Vertebrate” and “Type”) assigned to it, which have their own specific terms, for “Vertebrate” it will be “Mammals” and “Reptiles”, and for “Type” it will be “water type” and “ground type”. By using page.php I would like to display a list of […]