🏄♂️
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( ! defined( 'WPINC' ) ) { | |
die; | |
} | |
/** | |
* Class autoloader | |
* | |
* @param string $class Qualified class name. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.prototype.shuffle = function() { | |
var i = this.length, // array length to determine current index in loop | |
r, // random index value | |
p; // current index value | |
// Loop through array indicies | |
while ( i-- ) { | |
// always returns less than the index to ensure it always exists | |
r = Math.floor( Math.random() * i ); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get theme logo URL | |
*/ | |
function xx_get_logo() { | |
$custom_logo_id = get_theme_mod( 'custom_logo' ); | |
if ( ! $custom_logo_id ) | |
return; | |
$image = wp_get_attachment_image_src( $custom_logo_id , 'full' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Exclude `Uncategorized` category from all terms lists. | |
* | |
* @param array $terms Array of taxonomy terms. | |
* @return array List of terms, less 1 | |
*/ | |
function xx_exclude_terms_uncategorized( $terms ) { | |
$exclude_terms = [ 1 ]; // Exclude `Uncategorized` category | |
if ( ! empty( $terms ) && is_array( $terms ) ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Validate text input as valid URL for WordPress. | |
* | |
* @param string $text Text from field. | |
*/ | |
function xx_get_field_as_link( $text ) { | |
if ( ! empty( $text ) ) { | |
// If first character of link is a /, assume a relative URL | |
if ( substr( $text, 0, 1 ) === '/' ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Wrap input inside a link to include in the body of the tweet. | |
* | |
* @todo more validation (URL?) | |
* | |
* @param string $url URL to use as a link. | |
* @param string $text Text to wrap. | |
* @return [type] Formatted HTML link. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Screen breakpoints for media queries | |
$breakpoints: ( | |
'medium': 40em, | |
'large': 64em, | |
'xlarge': 75em, | |
'xxlarge': 90em | |
) !default; | |
/// Mixin to manage responsive breakpoints | |
/// @link https://css-tricks.com/snippets/sass/mixin-manage-breakpoints/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Add to your bash or zsh profile | |
## Modify path to match where you keep your local WP installs | |
## Your install and theme names should match! | |
function localwp() { | |
cd ~/Desktop/local/"$@"/app/public/wp-content/themes/"$@" | |
} | |
## To use, type `localwp themename` (replace themename obvi) | |
## Now you’re in your theme directory! Yay! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Helper funnction to remove name suffixes. | |
* | |
* @param string $name Name. | |
* @return array Suffix-free name parts. | |
*/ | |
function xx_get_suffix_free_name_parts( $name ) { | |
// Format first and last names. | |
$parts = explode( ' ', (string) $name ); |
OlderNewer