Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Details Wordpress Version: 3.4 Theme Deadline Version 1.2 Site URL: littlenomads

Plugin being used to create the Custom Posts Types

1.Types Plugin – Custom Post Types, Taxonomies and Custom Fields 2. Custom Post Template

Problem: I have created a custom post type called "Accommodation" which is working fine. However I can't seem to get the custom post types to show up with the categories it shares and on the home page under one of my blocks.

This piece of code works on the block, however it only pullsthe custom post type and not the other posts that are also tagged under "pictures".

$tz_recent_posts = new WP_Query(); $tz_recent_posts->query('offset=1&post_type=Accommodation,page,post&caller_get_posts=1&posts_per_page=' . $tz_recent_number . '');

Any assistance that anyone can provide is appreciated.

share|improve this question

3 Answers 3

post_type is case-sensitive, and should be all lower case. Try changing Accommodation to accommodation, see what happens. You might also consider converting your query to arguments to pass to WP_Query() in the first place.

share|improve this answer

SickHippie might be right about trying lower-case but another error in your query is the use of "caller_get_posts" parameter. This has been deprecated since version 3.1. You should use ignore_sticky_posts instead.

share|improve this answer

Add to your child themes functions file:

function wpsites_add_cpt_home($query) {
if ( !is_admin() && $query->is_main_query() && is_home() ) {
  $query->set('post_type', array( 'post', 'accommodation' ) );
    }
  }

add_action('pre_get_posts','wpsites_add_cpt_home');

You could also add

category__in => array()

Source pre_get_posts

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.