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",""),t=prompt("Would you like to label headings? (Y/N)"),o=prompt("Would you like lists hyphenated? (Y/N)"),l=prompt("Would you like to format tables as markdown? (Y/N)"),n=prompt("Would you like to inject link sources into the text? {Y/N)");null!=e&&function e(r){let a=document.querySelector(r);if(a&&window.open(document.location.href),!a){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()&&a.contains(e)||e.parentNode.removeChild(e)});let i=a.cloneNode(!0);document.body.innerHTML="",document.body.appendChild(i);let d=document.getElementsByTagName("*");for(let s=0;s<d.length;s++)if("a"===d[s].tagName.toLowerCa
$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'];