Home / Admin / VIsual Campaign Builder: Add HTML Tags To Display In The HTML/CODE Block
Duplicate Snippet

Embed Snippet on Your Site

VIsual Campaign Builder: Add HTML Tags To Display In The HTML/CODE Block

By design, Charitable allows only certain HTML to be displayed in the HTML/CODE Block of the visual builder for campaigns (introduced in 1.8.0). This snippet allows you to add (or remove) tags to determine what isn't stripped and displayed on the frontend.

Code Preview
php
<?php
add_filter( 'charitable_campaign_builder_html_allowed_tags', 'example_charitable_add_html_tags_to_html_visual_builder', 10, 2 );
function example_charitable_add_html_tags_to_html_visual_builder( $allowed_html = array(), $campaign ) {
	// this replaces the default allowed tags with the following. Add or remove tags (and attributes) as needed.
	$allowed_html = array(
		'a'      => [
			'href'   => [],
			'class'  => [],
			'target' => [],
		],
		'p'      => [
			'class' => [],
		],
		'span'   => [
			'class' => [],
		],
		'div'    => [
			'class' => [],
		],
		'strong' => [
			'class' => [],
		],
		'em'     => [
			'class' => [],
		],
		'b'      => [
			'class' => [],
		],
		'i'      => [
			'class' => [],
		],
		'h1'     => [
			'class' => [],
		],
		'h2'     => [
			'class' => [],
		],
		'h3'     => [
			'class' => [],
		],
		'h4'     => [
			'class' => [],
		],
		'h5'     => [
			'class' => [],
		],
		'h6'     => [
			'class' => [],
		],
		'table'  => [
			'class' => [],
		],
		'tr'     => [
			'class' => [],
		],
		'td'     => [
			'class' => [],
		],
		'th'     => [
			'class' => [],
		],
	);
	return $allowed_html;
}

Comments

Add a Comment