Make WordPress Core

Opened 14 years ago

Closed 11 years ago

Last modified 11 years ago

#13040 closed feature request (worksforme)

author.php doesn't recognize custom_post_type posts written by user

Reported by: 10sexyapples's profile 10sexyapples Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:

Description

Working on nightly WP3.0. - custom theme, but, tested with TwentyTen as well and got same result. Not entirely sure if this is a bug or if it is intended behavior, but, the author template does not recognize posts of a custom post type. It will return a 404 if there are no "post" post_types and only "custom" post_types available to load. I thought it might be worth mentioning as well that I feel really strongly that there should be an archivalish-"post_type" template along with the single-"post_type" template. I have been struggling with the lack of one and have had to fall back on creating a page template that pulls in an archival type list via custom post type query, but, we all know how the paging issue is with that, and it seems like it would just plug right in to the logic of archive.php, or even index.php pulling in all "post" type posts by default. Why not let custom post types have their own "index.php"? that pulls in all of it's post types by default by simply making a file called "post_type".php. I made that sound way easier than it probably would be, but, you get the point. Just a thought.

Change History (9)

#1 @greenshady
14 years ago

There are two reason I'm against having the author template load other post types.

  • We've never loaded anything but the post post type before.
  • Custom post types are "custom." We should not make assumptions about how a site owner wants them displayed.

I do like the idea of showing specific post types on *my* author archive but that's because those posts fit in well there, and this is easy to do. It might not be ideal for others.

Also, unless something has changed, you should not get a 404. You should be getting a no posts found message.

#2 @10sexyapples
14 years ago

I hear what you are saying, but, I believe that the semantic direction that things are going in would be better served by keeping things as semantically close to what they are as possible, for example, one would expect the core author template behavior to include all things authored. One would also expect it to share the same behavior as the rest of the template hierarchy and funnel in the same direction. If an author-"something-specific" template doesn't exist, then use author.php, which includes all things authored and is a catch all. I read all of the discussions regarding the naming issue with the custom post type, and was in total agreement with the concept of "post" being a "type" of post-type. I won't quote the whole of that discussion, or in particular one person's very long and incredibly well written explanation ( can't remember who wrote it at the moment ), but, for me it was the clear direction of thought. I think this subject hits on the same topic, in that we have to break away from thinking of "post" as anything more than just another type of "post-type". And I really feel that we would heading in the wrong direction to give the "post" post-type templates like this that belong only to it. I feel pretty strongly that it shouldn't have any templates that belong specifically to it ( outside of index.php ... and I have some opinions on that as well of course ;-) )unless implicitly specified by a plugin, or theme developer. At the moment, I am developing a site for bringing arts into education where artists and teachers will be creating/authoring lesson plans. The lessons are a custom post type, which is only logical if using WP as a CMS. The lessons need to be searchable/filterable/related with how tos ( another custom post type ) and workshops ( yet another ). We won't be using the "post" post-type for anything other than news, and if I could go back and redo every site I've built, it would be the same scenario. The "post" post type is basically blog or news content for the most part. I hope you can see how if "post" post type is looked at with this "unique" factor, then, all of the "automatic" functions that would improve WP as a CMS sort of fly out the window. It becomes necessary to rewrite the whole template hierarchy to do anything with them. I've noticed that you're writing a framework that creates a new template hierarchy, how would you suggest having ( in my scenario for instance where I am building around three custom post types only ) an archive for all lessons, all howtos, and all workshops, and an author page which lists all of the content ordered by date created by one specific teacher? Just curious.

#3 @dd32
14 years ago

  • Milestone changed from Unassigned to Future Release
  • Type changed from defect (bug) to feature request

Paragraphs would be great.. not many people will read a huge blob of text like that.

None of the Post loops (Other than searches) display anything non-post. If you want other post_type's to display in the loops you'll need to modify the global query manually.

I dont have any code handy, but i'm sure someone will post some..

#4 @10sexyapples
14 years ago

Sorry for the blob dd32. It was way too late for me to be trying to type the other night ;-).

It would be greatly appreciated if anyone could post the code to properly modify the global query to include custom post types in everything, as well as to exclude default post types. And thank you for the explanation~

#5 @10sexyapples
14 years ago

Is there somewhere else that would be better suited to request explanation or code example of how to manually change the global query to include these custom post types? Doesn't look like anyone is interested in responding here?

#6 @10sexyapples
14 years ago

Justin,
In the back of my mind I had thought that I had read about your use of the pre_get_posts filter to associate the custom post types the way that I needed to, but, didn't come back around to finding it again until today. I'm glad I did, and thank you for having posted that as it didn't look like anyone was ever going to clarify that here. Thanks again.

#7 @channeleaton
11 years ago

  • Cc channeleaton added
  • Keywords changed from author.php, custom post_types to author.php custom post_types
  • Resolution set to wontfix
  • Status changed from new to closed

I believe this is resolved. Developers should create a new template file and use WP_Query, pre_get_posts or other method of modifying the query if they want to have CPTs in an author page.

#8 @helen
11 years ago

  • Keywords author.php custom post_types removed
  • Resolution changed from wontfix to worksforme

#9 @helen
11 years ago

  • Milestone Future Release deleted
Note: See TracTickets for help on using tickets.