Skip to content

Instantly share code, notes, and snippets.

Avatar

Controlled Chaos Design ControlledChaos

View GitHub Profile
@ControlledChaos
ControlledChaos / pe-customize-controls.css
Created December 3, 2021 16:25 — forked from OriginalEXE/pe-customize-controls.css
Extending WordPress Customizer Panels and Sections to allow nesting
View pe-customize-controls.css
.in-sub-panel #customize-theme-controls .customize-pane-child.current-panel-parent,
#customize-theme-controls .customize-pane-child.current-section-parent {
-webkit-transform: translateX(-100%);
-ms-transform: translateX(-100%);
transform: translateX(-100%);
}
@ControlledChaos
ControlledChaos / acf-tab-merge.php
Last active September 25, 2021 00:19 — forked from darylldoyle/acf-tab-merge.php
ACF Tab Merge
View acf-tab-merge.php
<?php
/*
Plugin Name: ACF Tab Merge
Plugin URI: https://enshrined.co.uk/2017/06/14/merging-acf-field-group-tabs/
Description: Merges tabs across field groups in ACF
Version: 1.0.0
Author: enshrined
Author URI: https://enshrined.co.uk
*/
@ControlledChaos
ControlledChaos / gist:2b817720fb3209777064228d00d6ed68
Created March 24, 2021 03:12 — forked from danielbachhuber/gist:7126249
Include posts from authors in the search results where either their display name or user login matches the query string
View gist:2b817720fb3209777064228d00d6ed68
<?php
/**
* Include posts from authors in the search results where
* either their display name or user login matches the query string
*
* @author danielbachhuber
*/
add_filter( 'posts_search', 'db_filter_authors_search' );
function db_filter_authors_search( $posts_search ) {
@ControlledChaos
ControlledChaos / functions.php
Created January 1, 2021 09:31 — forked from tripflex/functions.php
WordPress Remove Filter (remove_filter converted to remove_class_filter) to remove Filter/Action without Class Object access. Works with WordPress 1.2+ (4.7+ support added 9-19-2016)
View functions.php
<?php
/**
* Make sure the function does not exist before defining it
*/
if( ! function_exists( 'remove_class_filter' ) ){
/**
* Remove Class Filter Without Access to Class Object
*
* In order to use the core WordPress remove_filter() on a filter added with the callback
@ControlledChaos
ControlledChaos / php-style-guide.md
Created December 24, 2020 01:40 — forked from ryansechrest/php-style-guide.md
PHP style guide with coding standards and best practices.
View php-style-guide.md

PHP Style Guide

All rules and guidelines in this document apply to PHP files unless otherwise noted. References to PHP/HTML files can be interpreted as files that primarily contain HTML, but use PHP for templating purposes.

The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Most sections are broken up into two parts:

  1. Overview of all rules with a quick example
  2. Each rule called out with examples of do's and don'ts
@ControlledChaos
ControlledChaos / whichones.js
Created December 23, 2020 05:12 — forked from scottjehl/whichones.js
which elements are wider than the viewport?
View whichones.js
var list = [];
document.querySelectorAll("body *")
.forEach(function(elem){
if(elem.getBoundingClientRect().width > document.body.getBoundingClientRect().width){
list.push(elem.outerHTML.split('>')[0] + '>');
}
});
confirm( "these elements are wider than the viewport:\n\n " + list.join("\n") )
@ControlledChaos
ControlledChaos / ExtendedReflectionClass.php
Created December 12, 2020 16:37 — forked from Zeronights/ExtendedReflectionClass.php
PHP: Getting use statements and aliases from class
View ExtendedReflectionClass.php
<?php
/**
* The MIT License (MIT)
*
* Copyright (c) Ozgur (Ozzy) Giritli <ozgur@zeronights.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
@ControlledChaos
ControlledChaos / easings.css
Created July 21, 2020 07:13 — forked from argyleink/easings.css
Handy CSS properties for easing functions
View easings.css
:root {
--ease-in-quad: cubic-bezier(0.55, 0.085, 0.68, 0.53);
--ease-in-cubic: cubic-bezier(0.55, 0.055, 0.675, 0.19);
--ease-in-quart: cubic-bezier(0.895, 0.03, 0.685, 0.22);
--ease-in-quint: cubic-bezier(0.755, 0.05, 0.855, 0.06);
--ease-in-expo: cubic-bezier(0.95, 0.05, 0.795, 0.035);
--ease-in-circ: cubic-bezier(0.6, 0.04, 0.98, 0.335);
--ease-out-quad: cubic-bezier(0.25, 0.46, 0.45, 0.94);
--ease-out-cubic: cubic-bezier(0.215, 0.61, 0.355, 1);
--ease-out-quart: cubic-bezier(0.165, 0.84, 0.44, 1);
@ControlledChaos
ControlledChaos / autoload.php
Created January 28, 2020 07:07 — forked from sheabunge/autoload.php
Basic PHP class autoloader that follows the WordPress coding standards for class names and class filenames
View autoload.php
<?php
namespace Shea\Example_Plugin;
/**
* Enable autoloading of plugin classes in namespace
* @param $class_name
*/
function autoload( $class_name ) {
@ControlledChaos
ControlledChaos / WP Customizer - URL
Created January 19, 2020 06:32 — forked from ajskelton/WP Customizer - URL
Add a URL field to the WordPress Customizer.
View WP Customizer - URL
$wp_customize->add_setting( 'themeslug_url_setting_id', array(
'capability' => 'edit_theme_options',
'sanitize_callback' => 'themeslug_sanitize_url',
) );
$wp_customize->add_control( 'themeslug_url_setting_id', array(
'type' => 'url',
'section' => 'custom_section', // Add a default or your own section
'label' => __( 'Custom URL' ),
'description' => __( 'This is a custom url input.' ),