Skip to content

Instantly share code, notes, and snippets.

View gbissland's full-sized avatar

Gareth gbissland

  • Weave Digital Studio
  • New Zealand
View GitHub Profile
@gbissland
gbissland / git-updater-ignore.php
Last active July 11, 2024 05:27 — forked from afragen/git-updater-ignore.php
Folk of plugin to ignore specific repositories from Git Updater for Weave sites
<?php
/**
* Plugin Name: Weave - Git Updater Ignore
* Plugin URI: https://gist.github.com/gbissland/61d919aeb79342a227c261159776ca03
* Description: Folk of plugin to set Git Updater to ignore specific repository slugs for Weave Digital sites.
* Version: 0.1
* Author: Gareth Bissland, Andy Fragen
* Requires at least: 5.2
* Requires PHP: 5.6
* Gist Plugin URI: https://gist.github.com/gbissland/61d919aeb79342a227c261159776ca03
@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 / 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
/* 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 / 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
@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 / breadcrumbs.php
Created April 4, 2018 05:57 — forked from bluedognz/breadcrumbs.php
This works with Beaver Themer and Astra Theme using [my_breadcrumb] (ie: Insert the shortcode into a Themer Part to display breadcrumbs)
function my_breadcrumb() {
if ( function_exists('yoast_breadcrumb') ) {
return yoast_breadcrumb( '<p id="breadcrumbs">', '</p>', false);
}
}
add_shortcode( 'my_breadcrumb', 'my_breadcrumb' );
@gbissland
gbissland / cpt_projects for Camel
Created February 8, 2018 01:33
cpt_projects for Camel
if ( ! function_exists('cpt_projects') ) {
// Register Custom Post Type
function cpt_projects() {
$labels = array(
'name' => 'project',
'singular_name' => 'Project',
'menu_name' => 'Camel Projects',
'name_admin_bar' => 'Post Type',
@gbissland
gbissland / style.css
Created December 7, 2017 19:08 — forked from pro-beaver/style.css
Change Row Background Image to Background Color for mobile devices
/**
* Change Row Background Image to Background Color for mobile devices
* assign pro-row-bg-1 class to the row
*
* @author Davinder Singh Kainth
* @link http://probeaver.com/?p=348
*
*/
@media only screen and (max-width: 768px) {
@gbissland
gbissland / gist:1d89270cd0c7c664a32316e337f32d98
Created August 22, 2017 23:53
Adding Typekit Font to Customizer in BB Theme
//must first add typkit js id in page header scripts
add_action( 'init', 'customize_font_list' );
function customize_font_list(){
$custom_fonts = array(
'proxima-nova' => array(
'fallback' => 'sans-serif',
'weights' => array(
'100',
'300',