Skip to content

Instantly share code, notes, and snippets.

View NatalieMac's full-sized avatar

Natalie NatalieMac

View GitHub Profile
<nav aria-label="<?php esc_attr_e( 'Pagination', 'my-text-domain' ); ?>">
<?php echo paginate_links( array(
'type' => 'list',
'prev_next' => false,
'before_page_number' => '<span class="screen-reader-text">' . __( 'Page', 'my-text-domain' ) . '</span> '
) ); ?>
</nav>
@NatalieMac
NatalieMac / pagination.html
Last active May 7, 2019 04:45
Accessible pagination markup
<nav aria-label="Pagination">
<ul>
<li><span class="pagination__item" href="#" aria-current="page" class="current" aria-label="Current Page, Page 1">1</span></li>
<li><a class="pagination__item" href="#" aria-label="Page 2">2</a></li>
<li><a class="pagination__item" href="#" aria-label="Page 3">3</a></li>
<li><a class="pagination__item" href="#" aria-label="Page 4">4</a></li>
<li><a class="pagination__item" href="#" aria-label="Page 5">5</a></li>
</ul>
</nav>
@NatalieMac
NatalieMac / trigger-draw-attention.js
Last active February 12, 2019 23:46
Highlight hotspots from an automatically generated select element
jQuery(document).ready(function($){
/* Select the container for the hotspots */
var daImage = $('.hotspots-container');
/* Select all the areas in the container */
var areas = daImage.find('area');
/* Create a new select element */
var newSelect = $('<select id="daSelector"><option>Island</option></select>');
/* Prepend the select before the container */
<?php
function alphaindex_save_alpha( $post_id ) {
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
return;
//only run for songs
$slug = 'song';
$letter = '';
// If this isn't a 'song' post, don't update it.
if ( isset( $_POST['post_type'] ) && ( $slug != $_POST['post_type'] ) )
return;
<?php
function alphaindex_queries( $query ) {
/* Sort songs alpha */
if ( ! is_admin() && ( is_post_type_archive( 'song' ) || is_tax( 'alpha' ) ) && $query->is_main_query() ) {
$query->set('orderby', 'name');
$query->set('order', 'ASC');
}
}
add_action( 'pre_get_posts', 'alphaindex_queries' );
@NatalieMac
NatalieMac / index.js
Created May 3, 2017 21:51
Remove typekit stylesheets
var styleTags = jQuery('style');
var typekitStyles = styleTags.filter(':contains("typekit")');
typekitStyles.remove();
$( 'a[href*="#"]:not([href="#"])' ).click( function(e) {
var $this_link = $( this ),
has_closest_smooth_scroll_disabled = $this_link.closest( '.et_smooth_scroll_disabled' ).length,
has_closest_woocommerce_tabs = ( $this_link.closest( '.woocommerce-tabs' ).length && $this_link.closest( '.tabs' ).length ),
has_closest_eab_cal_link = $this_link.closest( '.eab-shortcode_calendar-navigation-link' ).length,
has_acomment_reply = $this_link.hasClass( 'acomment-reply' ),
disable_scroll = has_closest_smooth_scroll_disabled || has_closest_woocommerce_tabs || has_closest_eab_cal_link || has_acomment_reply;
if ( ( location.pathname.replace( /^\//,'' ) == this.pathname.replace( /^\//,'' ) && location.hostname == this.hostname ) && ! disable_scroll ) {
var target = $( this.hash );
@NatalieMac
NatalieMac / index.html
Created February 25, 2017 19:20
Intro to React // source http://jsbin.com/kuqekih
<!DOCTYPE html>
<html>
<head>
<title>Intro to React</title>
<meta charset="utf-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-with-addons.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/redux/3.5.2/redux.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-redux/4.4.5/react-redux.js"></script>
;(function ($, dacustom, undefined) {
dacustom.init = function() {
var areas = $('area.more-info-area');
areas.each(function(){
var $this = $(this);
var api = $this.qtip('api');
api.set('position.adjust.mouse', false);
@NatalieMac
NatalieMac / style.css
Created January 10, 2014 03:37
Step 1: CSS to style text on hover image lists
ul.img-list {
list-style-type: none;
margin: 0;
padding: 0;
text-align: center;
}
ul.img-list li {
display: inline-block;
height: 150px;