Skip to content

Instantly share code, notes, and snippets.

View danemorgan's full-sized avatar

Dane Morgan danemorgan

View GitHub Profile
@danemorgan
danemorgan / property-organization.css
Created May 27, 2017 10:54
CSS Property Order #css #organization
.selector {
/* Positioning */
position: absolute;
z-index: 10;
top: 0;
right: 0;
/* Display & Box Model */
display: inline-block;
overflow: hidden;
@danemorgan
danemorgan / trusted-comment-links.php
Created February 6, 2017 21:34
Removes nofollow from rel tags in comment links with trusted in their class attribute.
@danemorgan
danemorgan / date.php
Created February 3, 2017 01:19
PHP date formats for my preferred formats
$date = date( 'Y-m-d', $timestamp ); // 2017-01-01
$time = date( 'H:i', $timestamp); // 01:00 / 13:00
$date_time = date( 'Y-m-d H:i', $timestamp ); // 2017-01-01 01:00
@danemorgan
danemorgan / shortcode_regex.php
Created January 24, 2017 23:20
Find shortcodes in WordPress Posts
<?php
// Regular Expression to match [shortcodes].
$regex = '(\[title(.*?)?\](.+?)?\[\/title\])';
// Store them in an array
preg_match( $regex, $content, $action_matches );
// Remove them.
preg_replace( $regex, '', $content );
@danemorgan
danemorgan / custom-header-right-way.php
Last active January 19, 2017 22:50
Checking for custom options in WordPress Customizer. Don't use HEADER_TEXTCOLOR
<?php
/**
* Do it this way instead
***********************************************/
/*
* If no custom options for text are set, let's bail.
* get_header_textcolor() options: Any hex value, 'blank' to hide text. Default: add_theme_support( 'custom-header' ).
*/
if ( get_theme_support( 'custom-header', 'default-text-color' ) === $header_text_color ) {
@danemorgan
danemorgan / a11y-theme-review.txt
Last active January 19, 2017 10:50 — forked from davidakennedy/a11y-theme-review.txt
A collection of review template responses for WordPress theme reviews.
Hi there!
Thanks for creating a WordPress theme and submitting it to the WordPress.org directory! Since your theme also includes the accessibility-ready tag, I've also reviewed it according to those requirements, which you can find here: https://make.wordpress.org/themes/handbook/review/accessibility/
Required
Anything in this section will need to be fixed before the theme can be approved.
Keyboard Navigation
WP_Term Object (
[term_id] =>
[name] =>
[slug] =>
[term_group] =>
[term_taxonomy_id] =>
[taxonomy] =>
[description] =>
[parent] =>
[count] =>
@danemorgan
danemorgan / no-list-with-spans-wp-nav-menu.php
Created October 25, 2016 21:24
Output the WordPress wp_nav_menu with no <li> tags #WordPress #wp_nav_menu
<div class="menu-class">
<?php
$menuParameters = array(
'theme_location' => 'button_menu',
'container' => false,
'echo' => false,
'link_before' => '<span>',
'link_after' => '</span>',
'items_wrap' => '%3$s',
'depth' => 0,
@danemorgan
danemorgan / ganalytics_external_link_tracker.js
Last active October 18, 2018 13:49
Google analytics external links tracking code Include just before </html> #analytics #tracking #javascript From https://www.axllent.org/docs/view/track-outbound-links-with-analytics-js/#manually-track-outbound-links
@danemorgan
danemorgan / center-recaptch.css
Created October 7, 2016 19:04
Make Google Recaptcha display centered #css #recaptcha #center
.g-recaptcha {
width: 300px;
margin: 0 auto 1em auto;
}