fdsdsfdsfsdsf fdsfdsfs
Shortcode to Conditionally Hide STH based on existing Custom Meta Values
Works only with the total theme Framework. If a post has the custom Meta „enym_custom_meta“ and if this is empty then return a „hidden“ string. Otherwise, return a space (makes it more robust with some WP Kaery elements).
/**
* Add Custom Dynamic Variables.
*
* @link https://total.wpexplorer.com/docs/snippets/add-custom-dynamic-variables/
* @since 5.6.1
*/
add_filter( 'totaltheme/replace_vars/vars', function( $vars ) {
$custom_meta = get_post_meta(get_the_ID(), 'enym_custom_meta', true);
$vars['meta_conditional'] = ( !empty($custom_meta) && $custom_meta != 0 ) ? ' ' : 'hidden';
return $vars;
} );
Comments (0)