#48906 closed enhancement (fixed)
Twenty Twenty: Add context for twentytwenty_start_of_post_meta_list and twentytwenty_end_of_post_meta_list
Reported by: | msaari | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 5.3.1 | Priority: | normal |
Severity: | minor | Version: | |
Component: | Bundled Theme | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
The twentytwenty_get_post_meta() function is used in Twenty Twenty to output post meta on two locations: top of the post and the bottom of the post. Which location is used, depends on the $location parameter of the function.
The function also has two action hooks that can be used to output additional post meta information, for example if you have custom taxonomies, you can output those. However, the action hooks only get the $post_id as a parameter, so whatever custom post meta you want to add, you have no context information and no way to figure out whether you're adding to the post top or post bottom location: you're doing both at the same time.
There's a simple solution to this. The function uses $post_meta array to list which post meta fields are displayed and this is already filtered based on location. All that is needed is to pass the $post_meta array as a parameter for the action hooks.
Attachments (2)
Change History (8)
#3
@
5 years ago
- Keywords has-patch commit added
Hi there, welcome to WordPress Trac! Thanks for the ticket and the patch.
As far as I can see, passing both $post_meta
and $location
would be helpful here.
48906.diff does that and adjusts the documentation accordingly.
Patch for /inc/template-tags.php