This function customizes the countdown timer settings for specific elements within the Bricks builder interface. It specifically targets an element by ID, updating its countdown to end three hours from the current moment, enhancing user engagement and urgency.
Live example:
/** * Modify the settings of specific Bricks builder elements. * * This function targets a specific 'countdown' element by its ID and sets its countdown timer * to end three hours from the current time. It is hooked into the 'bricks/element/settings' filter, * allowing for dynamic adjustments based on element properties. * * @param array $settings The current settings for the element. * @param object $element The element object being processed. * @return array The modified settings array. */ function modify_countdown_element_settings($settings, $element) { // Check if this is the targeted 'countdown' element with the unique ID if ($element->name === 'countdown' && 'bqogdm' === $element->element['id']) { // Update the 'date' setting to 3 hours from the current time $settings['date'] = date('Y-m-d H:i:s', strtotime('+3 hours')); } // Return the updated settings return $settings; } // Hook the above function to the 'bricks/element/settings' filter add_filter('bricks/element/settings', 'modify_countdown_element_settings', 10, 2);