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 / acss-overrides.scss
Created September 1, 2023 00:04
ACSS Text Line Lengths Override
$sizes: ('xxl','xl','l','m','s','xs');
.brx-body{
@each $size in $sizes {
.text--#{$size} {
max-inline-size: var(--text-#{$size}-length);
}
}
}
@wpeasy
wpeasy / metaboc-to-atts
Created September 17, 2023 00:14
& Metabox Automagical Data Atts
<?php
/*
In Bricks Attributes -> Name - insert {echo:mb_data_atts}
Don't put anything in the Value field
*/
function mb_data_atts(){
$fields = get_post_meta(get_the_ID());
$out = "";
@wpeasy
wpeasy / main.css
Created October 1, 2023 00:57
Grouping WordPress CPTs
#adminmenu [id*="menu-posts-"]{
background-color: var(--bricks-color-primary);
}
#adminmenu [id*=menu-posts-] > a {
color: black;
}
#adminmenu [id*=menu-posts-] > a .wp-menu-image::before{
color: black;
}
@wpeasy
wpeasy / functions.php
Created October 2, 2023 00:20
WS Form fields to Thank You
<?php
function get_wsf_submission_by_url_hash(){
static $submission;
if(!isset($_GET['hash'])) return 'No Hash URL parameter';
if(!$submission){ $submission = wsf_submit_get_by_hash($_GET['hash']); }
return $submission;
}
function fetch_wsf_submission_field($field_id) {
@wpeasy
wpeasy / wpe-framework.scss
Last active December 19, 2023 18:50
WPE Framwork
/*###############################
SCSS VARIABLES
################################*/
$one-rem-in-px: 10px;
$clamp-vp-min: 480px;
$clamp-vp-max: 1600px;
$use-fluid-size: "on";
$use-fluid-headings: "on";
$use-fluid-text: "on";
@wpeasy
wpeasy / pointer-tracker.json
Last active December 19, 2023 00:27
JSON template for Bricks Pointer Tracker
{"content":[{"id":"pqqtzn","name":"section","parent":0,"children":["fdayxr","mixfao"],"settings":{},"label":"Code"},{"id":"fdayxr","name":"code","parent":"pqqtzn","children":[],"settings":{"code":"<script>\n/* Use this script to track status of any scripts\nThis is to ensure we don't ruun multiple times when code\nis run from Bricks Code Elements \nIdeally, all code shoule be moved to a Code Manager. By doing\nso, this control is not needed.\n*/\n((d) => {\n if (undefined === d.bbStatus) {\n let bbStatus = {};\n /* If flag is already set, return false\n Otherwise, set the flag and return true */\n const setStatus = (flag, value) => {\n if (undefined !== bbStatus[flag]) {\n return false;\n } else {\n bbStatus[flag] = value;\n return true;\n }\n }\n const getStatus = flag => {\n return bbStatus[flag];\n }\n const clearStatus = flag => {\n delete bbStatus[
@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
@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 / 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 / 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){