Skip to content

Instantly share code, notes, and snippets.

View chris-castillo-dev's full-sized avatar

Chris Castillo chris-castillo-dev

View GitHub Profile
/**
* Add Page Attrribute Terms (Taxonomy) to Body Tag
*/
function pro_page_attributes_class_to_body( $classes ){
if ( $pageTaxonomy = get_the_terms( get_the_ID(), 'page_attributes' ) ) {
foreach( $taxonomyTerm as $term ){
if(is_array($term)){
if(!empty($term['slug'])){
$termClass = 'page-attribute-' . $term['slug'];
array_push( $classes, $termClass );
function add_page_attributes_taxonomy() {
$args = array(
'label' => __( 'Page Attributes', 'textdomain' ),
'public' => false,
'rewrite' => false,
'hierarchical' => false,
'show_ui' => true,
'show_in_quick_edit' => true, // Added this line to show in Quick Edit
'show_admin_column' => true,
);
/**
* Add Page Terms (Taxonomy) to Body Tag
*/
function pro_page_taxonomy_class_to_body( $classes ){
if ( $pageTaxonomy = get_the_terms( get_the_ID(), 'my_taxonomy_slug' ) ) {
foreach( $taxonomyTerm as $term ){
if(is_array($term)){
if(!empty($term['slug'])){
$termClass = 'mytaxonomy-' . $term['slug'];
array_push( $classes, $termClass );
This bookmarklet is depreceated. Please see this GIST instead:
https://gist.github.com/chris-castillo-dev/a366eac12e58ce8fa44be355063e2fa6
javascript:!function(){var e=prompt("Please enter your selector","");null!=e&&function e(t){let o=document.querySelector(t);if(!o){console.log("No element found with the provided selector.");return}document.querySelectorAll("script, img, picture, canvas, figure, video, iframe, embed, object, map, audio, button, svg, head, link, header, footer, google-cast-launcher, select, textarea, input, form, label, datalist, fieldset, legend, meter, optgroup, option, output, progress").forEach(e=>{"header"===e.tagName.toLowerCase()&&o.contains(e)||e.parentNode.removeChild(e)});let r=o.cloneNode(!0);document.body.innerHTML="",document.body.appendChild(r);let l=document.getElementsByTagName("*");for(let a=0;a<l.length;a++)if("a"===l[a].tagName.toLowerCase()){let n=l[a].getAttribute("href");l[a].outerHTML='<a href="'+n+'">'+l[a].innerHTML+"</a>"}else{let i=l[a].attributes;for(;i.length>0;)l[a].removeAttribute(i[0].name)}for(let u=1;u<=6;u++){let d=document.getElementsByTagName("h"+u);for(let g=0;g<d.length;g++)d[g].textConte
$form.on('fluentform_submission_success', function() {
// You can run your own JS and will be run on successful form submission
var s = document.createElement('script');
var code = 'clarity("set", "conversionAction", "New Lead")';
try{
s.appendChild(document.createTextNode(code));
document.body.appendChild(s);
} catch(e){
s.text = code;
document.body.appendChild(s);
if( !wp_script_is( 'bricks-splide' ) ){
wp_enqueue_script( 'bricks-splide', '/wp-content/themes/bricks/assets/js/libs/splide.min.js', null, '4.0.6', true );
}
/**
* Populate Gutenberg Color Palette Colors
*/
function pro_populate_gutenberg_color_palette() {
// Disable Custom Colors
add_theme_support( 'disable-custom-colors' );
// Editor Color Palette
add_theme_support( 'editor-color-palette', array(
array(
/**
* Function to Send Bricks Form Data to Webhook
*/
function pro_bricks_form_to_webhook( $form ){
$data = $form->get_fields();
// The Bricks Form ID is the last part of the CSS ID
// So if a form has a CSS ID of bricks-element-fszxsr, then the form ID is fszxsr
$formId = $data['formId'];