Skip to content

Instantly share code, notes, and snippets.

View kerelist's full-sized avatar

andrea kereliuk kerelist

View GitHub Profile
@kerelist
kerelist / tabbable-two-level-menu-vanilla-js.js
Last active June 20, 2017 21:56
A vanilla js configurable reusable snippet to add tab functionality to two-level dropdown navigation elements.
/**
* const globals
* = general helper functions
**/
const globals = {
//from https://gomakethings.com/climbing-up-and-down-the-dom-tree-with-vanilla-javascript/
getClosest: function ( elem, selector ) {
@kerelist
kerelist / font-setup-mixin.scss
Created November 22, 2016 21:18
A function/mixin set to set up all of your base font sizes in one @include statement.
//EXPONENT FUNCTION
//https://css-tricks.com/snippets/sass/power-function/
@function pow($number, $exponent) {
$value: 1;
@if $exponent > 0 {
@for $i from 1 through $exponent {
$value: $value * $number;
}
@kerelist
kerelist / wp-add-cms-instruction-box.php
Created November 18, 2016 17:20
Add a custom widget box on the sidebar of chosen page or post types to provide instructions to the content editor.
add_action( 'add_meta_boxes', 'add_side_instructions_box' );
function add_side_instructions_box() {
foreach( array( 'custom_post_type', 'page' ) as $customPages ) { //list which posts you would like this to appear on
add_meta_box(
'project_side_instructions', //meta box id
__( 'Helpful Hints', 'site_domain' ), //meta box title
'inner_side_instructions_box', //callback to function with box content
$customPages, //which pages the box appears on
'side', //area of page where the box appears
@kerelist
kerelist / wp-example-custom-dashboard-widget.php
Last active November 18, 2016 16:59
Add an example custom widget to the WordPress Dashboard
function project_add_dashboard_widgets() {
wp_add_dashboard_widget(
'project_hint_dashboard_widget', // Widget slug.
'Title Here', // Title.
'project_hint_dashboard_widget_function' // Display function.
);
}
//this function matches the display function in the above code
function project_hint_dashboard_widget_function() {
@kerelist
kerelist / terminus-search-replace.sh
Last active February 5, 2016 03:41 — forked from wpscholar/terminus-search-replace.sh
WP-CLI Search and Replace via Terminus (on Pantheon)
terminus wp "search-replace 'mysite.local' 'dev-mysite.pantheon.io'" --site=mysite
@kerelist
kerelist / terminus-search-replace-skip-plugin.sh
Last active February 5, 2016 03:40
Perform Pantheon-specific terminus wp search-replace that skips a plugin (use if plugin is triggering a URL redirect warning with Backtrace).
terminus wp "search-replace 'old-url' 'new-url' --skip-plugins=plugin-file-name-here" --site=your-site-name --env=dev-or-test-or-live