Skip to content

Instantly share code, notes, and snippets.

View wpeasy's full-sized avatar

Alan Blair wpeasy

  • WPEasy Pty Ltd
  • Brisbane Australia
View GitHub Profile
@wpeasy
wpeasy / javascript.js
Created April 19, 2024 06:39
Bricks fix focus state.
(() => {
document.addEventListener("DOMContentLoaded", () => {
const removeCSSRule = (selectorText) => {
// Get all stylesheets in the document
const stylesheets = document.styleSheets;
// Loop through all stylesheets
for (let i = 0; i < stylesheets.length; i++) {
const stylesheet = stylesheets[i];
@wpeasy
wpeasy / template-v1.json
Created April 14, 2024 21:42
Bricks Multi Getter
{"content":[{"id":"pvgpqz","name":"block","parent":"qpveqx","children":["nplvpo","bnytfm"],"settings":{"_cssGlobalClasses":["vqsvry"]},"label":"Greeter"},{"id":"nplvpo","name":"block","parent":"pvgpqz","children":["krzjsc","pcvgqk","xkljep","bsbgde"],"settings":{"_cssGlobalClasses":["jygnpk"]},"label":"Message"},{"id":"bnytfm","name":"block","parent":"pvgpqz","children":["tayvfi"],"settings":{"_cssGlobalClasses":["ffvjmd"]},"label":"Triggers"},{"id":"krzjsc","name":"heading","parent":"nplvpo","children":[],"settings":{"text":"I am a heading","_cssGlobalClasses":["wfbmzt"]}},{"id":"pcvgqk","name":"text","parent":"nplvpo","children":[],"settings":{"text":"<p>Here goes your text ... Select any part of your text to access the formatting toolbar.</p>","_cssGlobalClasses":["cbatsv"]},"label":"Text"},{"id":"xkljep","name":"button","parent":"nplvpo","children":[],"settings":{"text":"I am a button","style":"primary","_cssGlobalClasses":["mkkvzf","kmdcmf"],"link":{"type":"external","url":"#"}},"label":"CTA"},{"id":"byn
@wpeasy
wpeasy / rest-endpoint.php
Created March 29, 2024 02:44
Bricks Live Update Options
<?php
add_action('rest_api_init', 'wpe_register_live_options_rest_route');
function wpe_register_live_options_rest_route() {
register_rest_route('v1/wpe_live_options', '/get_options', array(
'methods' => 'GET',
'callback' => 'mb_live_options_get_options',
'permission_callback' => 'wpe_verify_referrer_hostname'
));
@wpeasy
wpeasy / bb-custom-animations.json
Created March 18, 2024 10:34
Bricks Builder Custom animations
{"content":[{"id":"tzokwu","name":"section","parent":0,"children":["dnmjru","vzhpze","pxrcda"],"settings":{}},{"id":"dnmjru","name":"container","parent":"tzokwu","children":["srcfhs"],"settings":[]},{"id":"srcfhs","name":"text","parent":"dnmjru","children":[],"settings":{"text":"<p>There it is. With something so strong, a little bit can go a long way. Let your heart be your guide. Let's make a nice big leafy tree. Let's do it again then, what the heck. We can always carry this a step further. There's really no end to this.</p><p>There isn't a rule. You just practice and find out which way works best for you. I started painting as a hobby when I was little. I didn't know I had any talent. I believe talent is just a pursued interest. Anybody can do what I do. Nice little fluffy clouds laying around in the sky being lazy. If you overwork it you become a cloud killer. There's nothing worse than a cloud killer. You got your heavy coat out yet? It's getting colder. Be brave.</p><p>The very fact that you're aware of
@wpeasy
wpeasy / content-toggle-template.json
Created March 2, 2024 22:36
CSS Only Content Toggle
{"content":[{"id":"vycagh","name":"section","parent":0,"children":["emodvu"],"settings":{"_cssGlobalClasses":["shblsr"],"_cssCustom":"#brxe-vycagh { \n \n\t--state-0-color: var(--action);\n --state-0-label-color: var(--action-light);\n --state-0-track-color: var(--secondary-light-trans-30); \n --state-0-label-0-color: white;\n --state-0-label-1-color: var(--primary);\n \n --state-1-color: var(--primary); \n --state-1-label-color: var(--primary-dark);\n --state-1-track-color: var(--primary-light-trans-20);\n --state-1-label-0-color: var(--action-light);\n --state-1-label-1-color: white;\n \n}"},"label":"Free Pro"},{"id":"emodvu","name":"container","parent":"vycagh","children":["dhlctq","spcnac"],"settings":{"_cssGlobalClasses":["dpfyhy"]},"label":"switcher wrapper (CSS)"},{"id":"dhlctq","name":"block","parent":"emodvu","children":["igpdel","erdeuh","prerjb"],"settings":{"_alignItems":"center","_cssGlobalClasses":["tiobzx"]},"label":"Header Wrapper"},{"id":"igpdel","name":"heading","parent":"dhlctq"
@wpeasy
wpeasy / checkbox-switcher.json
Created February 27, 2024 22:26
Bricks Checkbox Switcher
{"id":331,"name":"checkbox-switcher","title":"Checkbox Switcher","date":"2024-02-27 22:25:10","date_formatted":"February 27, 2024","author":{"name":"wpeasy","avatar":"https:\/\/secure.gravatar.com\/avatar\/9911a97df3fb8c171d76f74f51feb01b?s=60&d=mm&r=g","url":"http:\/\/base-wordpress.local"},"permalink":"https:\/\/base-wordpress.local\/template\/checkbox-switcher\/","thumbnail":false,"bundles":[],"tags":[],"type":"section","content":[{"id":"vycagh","name":"section","parent":0,"children":["emodvu"],"settings":[],"label":"Checkbox Based"},{"id":"emodvu","name":"container","parent":"vycagh","children":["dhlctq","jippoh","mfwwqu"],"settings":{"_cssCustom":"\n.bricks-is-frontend #brxe-emodvu:has(.toggle-switch__checkbox:checked) .state-0-content{\n\tdisplay: none;\n}\n\n\n.bricks-is-frontend #brxe-emodvu:not(:has(.toggle-switch__checkbox:checked)) .state-1-content{\n\tdisplay: none;\n}"},"label":"Free Pro switcher (CSS)"},{"id":"dhlctq","name":"block","parent":"emodvu","children":["igpdel","erdeuh","prerjb"],"sett
@wpeasy
wpeasy / hide_paid_if_free_available
Created February 17, 2024 00:22
Woocommerce Hide Paid Shipping id qualify for free.
<?php
/**
* Hide paid shipping methods if free shipping is available.
*/
/*
$name should be the part before the : separaor
*/
function wpe_find_shipping_method($name, $rates){
@wpeasy
wpeasy / snippet.php
Last active February 6, 2024 05:40
Bricks Builder: Restrict content based on Password Levels
<?php
define("WPE_AUTH_TRACKER_TABLE_NAME", "wpe_ip_tracker");
define("WPE_AUTH_TRACKER_MAX_AGE", 14400); /* 4 hours */
function maybe_create_ip_tracking_table()
{
/* ensure called only once per load */
static $initialised;
if ($initialised) {
@wpeasy
wpeasy / default-to-list.php
Last active January 5, 2024 07:21
Bricks Default Colors to a List
<?php
add_action('get_footer', function(){
if (!class_exists('Bricks\Capabilities')) {
return;
}
if( !bricks_is_builder() ) return;
?>
@wpeasy
wpeasy / template.json
Created December 21, 2023 02:12
Bricks hero with synchronised transitions.
{"content":[{"id":"rwtoje","name":"section","parent":0,"children":["vryybc","mjxsbw","wwmhrs"],"settings":{"_cssGlobalClasses":["yiubhh","smelsw"]},"label":"Hero 1 (CSS)"},{"id":"vryybc","name":"image","parent":"rwtoje","children":[],"settings":{"tag":"figure","caption":"none","_cssGlobalClasses":["kudcmj","lmmpmw"],"image":{"id":11,"filename":"6a0e467f-803c-32eb-a1bd-986eba296d67.jpg","size":"large","full":"https://bricks-only-live-demos.local/wp-content/uploads/2023/12/6a0e467f-803c-32eb-a1bd-986eba296d67.jpg","url":"https://bricks-only-live-demos.local/wp-content/uploads/2023/12/6a0e467f-803c-32eb-a1bd-986eba296d67-1024x682.jpg"}},"label":"Overlay Image"},{"id":"mjxsbw","name":"block","parent":"rwtoje","children":[],"settings":{"_cssGlobalClasses":["rczaig","swsrem","rwlhym"]},"label":"Overlay Block"},{"id":"wwmhrs","name":"container","parent":"rwtoje","children":["gpzyue"],"settings":{"_cssGlobalClasses":["otowbe"]},"label":"Wrapper"},{"id":"gpzyue","name":"block","parent":"wwmhrs","children":["qhjlra","v