Skip to content

Instantly share code, notes, and snippets.

View gbissland's full-sized avatar

Gareth Bissland gbissland

View GitHub Profile
@gbissland
gbissland / imageseo
Created April 4, 2018 07:25 — forked from bluedognz/imageseo
Automatically set the image Title, Alt-Text, Caption & Description upon upload
/* Automatically set the image Title, Alt-Text, Caption & Description upon upload
--------------------------------------------------------------------------------------*/
add_action( 'add_attachment', 'my_set_image_meta_upon_image_upload' );
function my_set_image_meta_upon_image_upload( $post_ID ) {
// Check if uploaded file is an image, else do nothing
if ( wp_attachment_is_image( $post_ID ) ) {
$my_image_title = get_post( $post_ID )->post_title;
@gbissland
gbissland / gist:dfed453ed3cf06a57e14eed6ed398480
Created April 10, 2018 04:53 — forked from mannieschumpert/gist:8334811
Filter the submit button in Gravity Forms to change the <input type="submit> element to a <button> element. There's an example in the Gravity Forms documentation, but it lacks the proper code to show your custom button text, AND removes important attributes like the onclick that prevents multiple clicks. I was trying to solve that.
<?php
// filter the Gravity Forms button type
add_filter("gform_submit_button", "form_submit_button", 10, 2);
function form_submit_button($button, $form){
// The following line is from the Gravity Forms documentation - it doesn't include your custom button text
// return "<button class='button' id='gform_submit_button_{$form["id"]}'>'Submit'</button>";
// This includes your custom button text:
return "<button class='button' id='gform_submit_button_{$form["id"]}'>{$form['button']['text']}</button>";
}
// Oops this strips important stuff
/* form placeholder overrides - have to use !important or this doesn't work
--------------------------------------------- */
::-webkit-input-placeholder { /* Chrome */
color: #1E1F22 !important;
}
:-ms-input-placeholder { /* IE 10+ */
color: #1E1F22 !important;
}
::-moz-placeholder { /* Firefox 19+ */
color: #1E1F22 !important;
@gbissland
gbissland / fix-wordpress-permissions.sh
Created January 28, 2019 17:13 — forked from Adirael/fix-wordpress-permissions.sh
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory
@gbissland
gbissland / bb-empty-menu-accessibility-fix.js
Created June 28, 2024 20:24
Fixes accessibility in BB for empty menu and site links by adding role="button"
// Select all elements with class 'fl-button' that do not have an href attribute starting with '#'
// These are considered real links, not buttons.
const notButtons = document.querySelectorAll('a.fl-button:not([href^="#"])');
// Remove the 'role' attribute from all selected real link elements.
for (let i = 0; i < notButtons.length; i++) {
notButtons[i].removeAttribute('role');
}
// Select all elements with an href attribute starting with '#', including menu items with such links.
@gbissland
gbissland / gp_global_color_grid.php
Last active January 14, 2025 20:33
GP Global Color Grid (for Styleguide)
<?php
/**
* Remove this opening PHP tag when adding to your theme's functions.php
* It's included here for proper syntax highlighting in the gist.
*/
/**
* Displays an grid of the GeneratePress global color palette with color blocks.
* Built to use on website style guides with Beaver Builder but can be used anywhere.
* Global Colors must be set in the GP Customiser
@gbissland
gbissland / devitkit.php
Created March 8, 2025 04:16
Configure DevKit error logs for Nginx Error logs on Gridpane
<?php
/**
* DevKit related tweaks
* https://dplugins.com/downloads/devkit/
*
* Must be included in functions.php
*
* @package GenerateChild
*/
You are the orchestrator.
You think, design and plan architectural decision only. Write only essential technical specs and reasoning. Prefer not to write code yourself unless all executors fail.
Never assume the user's intent. Ask for clarification for ambiguous situations.
Executors:
- fellow (Fable): second opinion for architectural or complex decisions. For hardest problem only.
- mechanical (Sonnet): mechanical for fast/small redundant tasks.
- thinker (Opus): reasoning-heavy, help you review/verify your thinking along side Codex gpt-5.6-sol below.