WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#16628 closed defect (bug) (invalid)

Parent or Child Themes for Post Formats?

Reported by: Lorelle Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.1
Component: Posts, Post Types Keywords: needs-testing close
Focuses: Cc:

Description

Testing with TwentyTen Theme and Weaver, post formats had to be added to child Theme functions.php in order to work. Shouldn't post formats be inherited from parent Theme? Tripled checked to ensure the placement was correct in the parent Theme. Works only when added to the Child Theme.

If true, we need to update Codex article accordingly.

Change History (6)

comment:1 jorbin3 years ago

  • Keywords close added

It seems to me that the child is overriding the call to:

add_theme_support( 'post-formats', ....

in the parent. Post Formats work fine on my twentyten child theme.

comment:2 GaryJ3 years ago

  • Cc GaryJ added

A child theme may support (in terms of providing explicit styling for) a different set / subset of post formats than a parent theme claims to support. As such, I would say that post format support should *only* be accepted from the child theme, not the parent.

comment:3 follow-up: Lorelle3 years ago

I searched throughout the Theme's code and can't find anything to override the call to the post formats. I continue to look, and it continues to only work in the Child Theme, not the Parent. Somehow, it isn't being inherited to the Child Theme.

On GaryJ's point, I believe that post format support must be set in the Parent Theme, especially when it comes to multisite or blog networks using Child Themes per blog. While the Child Theme should have rights to overwrite the Parent settings for Post Formats, it should be set by the Parent.

Hopefully soon there will be a Setting to manage post formats from the UI as this messing with the Theme code is very messy as placement of the post formats code must be done very specifically, allowing for Child Blogs on a network to pick and choose their options. Having a setting that would allow choosing the post format types and adding a touch of CSS to style the chosen ones would make all WordPress Themes be open to this option and not just those with the feature installed. Dreaming.

Version 0, edited 3 years ago by Lorelle (next)

comment:4 in reply to: ↑ 3 nacin3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Replying to Lorelle:

I searched throughout the Theme's code and can't find anything to override the call to the post formats. I continue to look, and it continues to only work in the Child Theme, not the Parent. Somehow, it isn't being inherited to the Child Theme. I'll be testing it this week with other Themes.

Post formats are inherited from the parent theme.

Calling add_theme_support() for post formats in the child theme will override the existing list, not add to it. Calling remove_theme_support('post-formats') will remove it all together.

If neither of these techniques work, then you're calling it too early. You'll probably need to wait until the after_setup_theme hook, priority 11. (Twenty Ten calls this at priority 10.)

On GaryJ's point, I believe that post format support must be set in the Parent Theme, especially when it comes to multisite or blog networks using Child Themes per blog. While the Child Theme should have rights to overwrite the Parent settings for Post Formats, it should be set by the Parent.

Yes. Any kind of theme can leverage post formats.

Hopefully soon there will be a Setting to manage post formats from the UI as this messing with the Theme code is very messy as placement of the post formats code must be done very specifically, allowing for Child Blogs on a network to pick and choose their options. Having a setting that would allow choosing the post format types and adding a touch of CSS to style the chosen ones would make all WordPress Themes be open to this option and not just those with the feature installed. Dreaming.

I don't see the point in a UI option here at all. If a parent theme wants to create a set of UI options for what it wishes to support, it can do so, and that makes sense in some situations. But not in core.

comment:5 Lorelle3 years ago

Thanks. I'll test this and add it to the Codex if the article needs updating.

And honestly, if post formats has been added to the core without some Admin access, it leaves folks digging into the code to get it working, which isn't the best of ideas. Just saying. More work for the support community to educate...no different from the custom post types.

Thanks!

Note: See TracTickets for help on using tickets.