Skip to content

Instantly share code, notes, and snippets.

View natejacobson's full-sized avatar

Nathan Jacobson natejacobson

  • Discovery Institute
  • Seattle, WA
View GitHub Profile
@natejacobson
natejacobson / prune_page_templates.php
Created June 23, 2015 18:28
Prune WordPress Template List in Child Theme
function prune_page_templates( $templates ) {
unset( $templates['templates/halves.php'] );
unset( $templates['templates/margin-left.php'] );
unset( $templates['templates/margin-right.php'] );
unset( $templates['templates/side-left.php'] );
unset( $templates['templates/side-right.php'] );
unset( $templates['templates/single.php'] );
return $templates;
}
add_filter( 'theme_page_templates', 'prune_page_templates' );
@natejacobson
natejacobson / datalist-accordion.html
Created July 7, 2015 23:56
Simple Datalist Accordion
<script>$('.folded dt').click( function() { $(this).toggleClass('unfolded').next('dd').toggleClass('unfolded'); });</script>
<style>
.folded dt,
.folded dd {
display: block;
}
.folded dt {
@natejacobson
natejacobson / Named item in array
Created November 19, 2013 17:13
Is there a way to do this with one command? Can I echo the specified array item without fetching the array first? These are coming from new customization options setup with $wp_customize. It is working, I'd just like to shorten.
<?php $spine_color = get_option( 'spine_theme_options' ); echo $spine_color['grid_style']; ?>
@natejacobson
natejacobson / dl-wp-nav-menu.php
Last active April 29, 2016 15:31
Datalist <dl> nav menu in WordPress
<nav>
<dl>
<?php
$menu_name = 'menu-name';
$locations = get_nav_menu_locations();
$menu = wp_get_nav_menu_object( $locations[ $menu_name ] );
$menuitems = wp_get_nav_menu_items( $menu->term_id, array( 'order' => 'DESC' ) );
$count = 0;
<article>
<header>Article Header</header>
<center>
<p>Once upon a time...</p>
<ul></ul>
</center>
<footer>Article Footer</footer>
</article>