Skip to content

Instantly share code, notes, and snippets.

View AdamSoucie's full-sized avatar

Adam Soucie AdamSoucie

View GitHub Profile
@AdamSoucie
AdamSoucie / class-wyvern-plugin.php
Last active January 22, 2020 05:16
For debugging
<?php
/**
* Define the core plugin class.
*
* A class definition that includes attributes and functions used across both the
* public-facing side of the site and the admin area.
*
* @since 1.0.0
*
@AdamSoucie
AdamSoucie / multi-level-flyout-a11y.js
Created December 14, 2019 15:00
Script that helps support multi-level flyout menus
// Global Variables
const subMenus = document.querySelectorAll( 'li.menu-item-has-children' );
let focasable;
let delayTimer;
let focusTimer;
let currentSubMenu;
// Deal with the sub-menus
if ( subMenus ) {
Array.prototype.forEach.call( subMenus, function( element, iterator ){
@AdamSoucie
AdamSoucie / load-assets.php
Created August 31, 2018 19:33
Loads assets for the child theme
<?php
/**
* Load files in the /assets/ directory
*
* @since 1.0.0
*/
function seven_pines_load_assets()
{
// Load the main Genesis stylesheet first
@AdamSoucie
AdamSoucie / gist-block.js
Created August 17, 2018 19:19
Block.js file for Gist Gutenberg Block
/**
* BLOCK: wds-gist
*/
// Import CSS.
import './style.scss';
import './editor.scss';
const { __ } = wp.i18n; // Import __() from wp.i18n
const { registerBlockType } = wp.blocks; // Import registerBlockType() from wp.blocks
@AdamSoucie
AdamSoucie / bb-frontend.php
Created August 17, 2018 19:14
Beaver Builder Gist Module - Front End
<?php
/**
* The frontend of the Gist Module.
*
* @package wds-gist
*/
// Get our fields.
$user_name = $settings->github_username;
$url = $settings->gist_url;
@AdamSoucie
AdamSoucie / with-toggle.php
Last active August 2, 2018 03:01
Select Field with Toggle
'fields' => array(
'module_layout' => array(
'type' => 'select',
'label' => __( 'Module Layout', 'wds-beaver-builder' ),
'default' => 'fifty-image-text',
'options' => array(
'fifty-image-text' => __( 'Image/Text', 'wds-beaver-builder' ),
'fifty-text-image' => __( 'Text/Image', 'wds-beaver-builder' ),
'fifty-text-text' => __( 'Text/Text', 'wds-beaver-builder' ),
),
@AdamSoucie
AdamSoucie / no-toggle.php
Created August 2, 2018 02:50
Beaver Builder Select Field (no toggle)
'module_layout' => array(
'type' => 'select',
'label' => __( 'Module Layout', 'wds-beaver-builder' ),
'default' => 'fifty-image-text',
'options' => array(
'fifty-image-text' => __( 'Image/Text', 'wds-beaver-builder' ),
'fifty-text-image' => __( 'Text/Image', 'wds-beaver-builder' ),
'fifty-text-text' => __( 'Text/Text', 'wds-beaver-builder' ),
),
<button id="main-menu-trigger" class="main-menu-trigger" role="button">Menu</button>
<nav id="main-menu-container" class="main-menu-container" role="navigation">
<ul id="main-menu" aria-expanded="false" role="menu">
<li id="menu-item-1" class="menu-item" role="menuitem">
<a href="#" role="link">Home</a>
</li>
<li id="menu-item-2" class="menu-item" role="menuitem">
<a href="#" role="link">About</a>
</li>
<li id="menu-item-3" class="menu-item" role="menuitem">
function toggleARIAExpanded(menu)
{
var isExpanded = menu.attr('aria-expanded');
if( isExpanded === 'true' )
{
menu.attr('aria-expanded', 'false');
menu.toggleClass('active');
}
else
<button id="main-menu-trigger" class="main-menu-trigger">Menu</button>
<nav id="main-menu-container" class="main-menu-container">
<ul id="main-menu" aria-expanded="false">
<li id="menu-item-1" class="menu-item">
<a href="#">Home</a>
</li>
<li id="menu-item-2" class="menu-item">
<a href="#">About</a>
</li>
<li id="menu-item-3" class="menu-item">