PHP code example of meom / meom-cookiebot-embed
1. Go to this page and download the library: Download meom/meom-cookiebot-embed library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
meom / meom-cookiebot-embed example snippets
/**
* Change condition when to show Cookiebot message.
*
* @param string $condition Condition.
* @param string $block_content The block content about to be appended.
* @param array $block The full block, including name and attributes.
*/
function my_prefix_cookiebot_embed_condition( $condition, $block_content, $block ) {
$condition = 'core/embed' === $block['blockName'] && ( 'youtube' === $block['attrs']['providerNameSlug'] || 'vimeo' === $block['attrs']['providerNameSlug'] );
return $condition;
}
add_filter( 'meom_cookiebot_embed_condition', 'my_prefix_cookiebot_embed_condition', 10, 3 );