Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've gone into my archive.php file and made some adjustments to incorporate my custom post type. Here's the code I've added BEFORE THE LOOP.

global $query_string;
parse_str( $query_string, $args );
$args['post_type'] = array( 'post', 'CUSTOM-POST-TYPE' );
query_posts( $args );

The results I'm getting are strange and I'm hoping someone can explain. If I view a day's archive it will bring back both post types if both post types are present. If there are NO regular posts then NOTHING is returned. It only works if there is also a regular post on the same day as the custom post.

And just in case your'e wondering the reason I'm trying to do things like this is to make the links from the calendar widget work. Any information and insight would be appreciated. If a moderator reads this could you bump it to the advanced forum possibly since I haven't had any bites here?

share|improve this question

closed as not a real question by toscho Jul 7 '12 at 1:08

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, see the FAQ.

2 Answers

I suggest you do the following to troubleshoot:

  1. print_r($query_string);
  2. print_r($args);

Look at the two and see if you can spot your mistake. I can't tell as I don't have access to your same $query_string.

If that doesn't give you any clues, try global:ing $wp_query and look at its query_var's.

share|improve this answer
Printing $query_string returned the specific date information. Printing the $args shows the array of post types I want. I'm still no closer to getting it right though. – huffmaster Aug 28 '11 at 0:26

I think you're not going into the right direction. If the problem is the widget, dont try to hack the archive page.

Take a look at this plugin wordpress-custom-post-type-archive maybe not the one you're searching but can be helpfull

If you doesnt yet, maybe is a good idea to look at Template Hierarchy for Custom Types

Good luck

share|improve this answer

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