{"id":2718,"date":"2022-07-07T17:56:12","date_gmt":"2022-07-07T17:56:12","guid":{"rendered":"https:\/\/academy.bricksbuilder.io\/?post_type=bricks_article&p=2718"},"modified":"2023-10-09T02:37:55","modified_gmt":"2023-10-09T02:37:55","slug":"filter-bricks-element-settings","status":"publish","type":"bricks_article","link":"https:\/\/academy.bricksbuilder.io\/article\/filter-bricks-element-settings\/","title":{"rendered":"Filter: bricks\/element\/settings"},"content":{"rendered":"\n
Bricks 1.5 adds the possibility to change the element settings before it is rendered. <\/p>\n\n\n\n
This allows you to change a text element content programmatically, or add styles based on a custom conditional logic, like so:<\/p>\n\n\n\n
add_filter( 'bricks\/element\/settings', function( $settings, $element ) {\n \/\/ Add \"[online]\" text to all the headings elements if the visitor is logged in \n if ( $element->name === 'heading' && is_user_logged_in() ) {\n $settings['text'] .= ' [online]'; \n }\n\n return $settings;\n}, 10, 2 );<\/code><\/pre>\n\n\n\nIn case you need to programmatically add an element conditional display logic, check the filter bricks\/element\/render<\/a><\/code>.<\/p>\n\n\n\n<\/p>\n\n\n\n
Example: Dynamically set WooCommerce Product Filter (Price) max price from all products<\/h5>\n\n\n\n