[wp-trac] [WordPress Trac] #58223: Twenty Twenty: twentytwenty_get_post_meta needs global $has_meta
WordPress Trac
noreply at wordpress.org
Wed Jun 21 01:44:24 UTC 2023
#58223: Twenty Twenty: twentytwenty_get_post_meta needs global $has_meta
---------------------------+------------------------------
Reporter: chiefastro | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Bundled Theme | Version:
Severity: normal | Resolution:
Keywords: needs-patch | Focuses: template
---------------------------+------------------------------
Comment (by chiefastro):
I believe I just declared $has_meta as a global here:
{{{#!php
<?php
// If the post meta setting has the value 'empty', it's explicitly
empty and the default post meta shouldn't be output.
if ( $post_meta && ! in_array( 'empty', $post_meta, true ) ) {
// Make sure we don't output an empty container.
global $has_meta;
$has_meta = false;
}}}
Then in my function that runs on the `twentytwenty_end_of_post_meta_list`
action, I set it to True like this:
{{{#!php
<?php
$GLOBALS['has_meta'] = true;
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58223#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list