Skip to content

Instantly share code, notes, and snippets.

@jnschrag
jnschrag / functions.php
Created August 31, 2016 18:58
Include featured images of posts and pages in WordPress menus
add_filter('wp_nav_menu_objects', 'ad_filter_menu', 10, 2);
function ad_filter_menu($sorted_menu_objects, $args) {
if ($args->menu->slug != 'home-page-slider')
return $sorted_menu_objects;
// edit the menu objects
foreach ($sorted_menu_objects as $menu_object) {
// searching for menu items linking to posts or pages
// can add as many post types to the array
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://d3js.org/topojson.v1.min.js"></script>
<!-- I recommend you host this file on your own, since this will change without warning -->
<script src="http://datamaps.github.io/scripts/datamaps.world.min.js?v=1"></script>
<h2>Datamaps Playground</h2>
<p><a href="http://datamaps.github.io/">DataMaps Project Homepage</a></p>
<div id="container1" style="position: relative; width: 80%; max-height: 450px;"></div>
@jnschrag
jnschrag / Code.gs
Last active May 24, 2018 13:36
Google Sheets Automatic Timestamp Updater on Row Edit
function onEdit() {
var s = SpreadsheetApp.getActiveSheet();
if( s.getName() == "Member Admissions Tracker" ) { //checks that we're on the correct sheet
var r = s.getActiveCell(); // Get our active cell
var column = r.getColumn(); // Get the column of the active cell
var row = r.getRow(); // Get the row of the active cell
if(row != 1) { // Don't do this for the first row
if(column != 4) { // Don't do this for the timestamp column