Skip to content

Total Theme ReplaCE VariabLES


/**
 * 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 ) {

    // Check if the post has a featured image
    if (has_post_thumbnail(get_the_ID())) {
        $class = 'xxx'.get_the_ID(); // Return an empty string if no featured image is set
    } else {
        $class = 'hidden'; // Return an empty string if no featured image is set
    }
	
	$vars['featured_cond'] = $class;

	return $vars;
} );

An den Anfang scrollen