<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
alleyinteractive / wp-experimental-features example snippets
/**
* Define available feature flags.
*
* @param array $flags Feature flags that have been defined for the Experimental Features plugin.
*
* @return array The modified list of feature flags.
*/
function filter_experimental_features_flags( $flags ): array {
$flags['my-cool-feature'] = __( 'My Cool Feature', 'my-textdomain' );
return $flags;
}
add_filter(
'experimental_features_flags',
__NAMESPACE__ . '\filter_experimental_features_flags'
);
/**
* A helper function for determining if a feature flag is enabled.
*
* @param string $slug The feature flag slug to check.
*
* @return bool True if enabled, false if not.
*/
function my_theme_flag_enabled( string $slug ): bool {
return (bool) apply_filters(
'experimental_features_flag',
false,
$slug
);
}