[wp-trac] [WordPress Trac] #48906: Twenty Twenty: Add context for twentytwenty_start_of_post_meta_list and twentytwenty_end_of_post_meta_list
WordPress Trac
noreply at wordpress.org
Sat Dec 7 03:48:36 UTC 2019
#48906: Twenty Twenty: Add context for twentytwenty_start_of_post_meta_list and
twentytwenty_end_of_post_meta_list
-------------------------+-----------------------------
Reporter: msaari | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Themes | Version:
Severity: minor | Keywords:
Focuses: |
-------------------------+-----------------------------
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.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/48906>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list