Skip to content

Instantly share code, notes, and snippets.

View michaelschofield's full-sized avatar

Michael Schofield michaelschofield

View GitHub Profile
@michaelschofield
michaelschofield / Simple Web Notification API Demo.markdown
Created September 11, 2015 15:01
Simple Web Notification API Demo

Simple Web Notification API Demo

You would think this would be a little harder, but the API is really easy and convenient to use.

A Pen by Michael Schofield on CodePen.

License.

ES6 Template String

Template strings let you create strings using backticks and a ${object} syntax, which is pretty familiar, to let you swap variables into strings less painfully.

A Pen by Michael Schofield on CodePen.

License.

var libchat = $( '[id^=libchat]' );
if ( libchat ) {
$.when(
$.getScript( '//v2.libanswers.com/load_chat.php?hash=350f6f82c9ebecede6fa0c8773102b53')
).done(function() {
<?php
add_action( 'after_setup_theme', 'advwp_create_upcoming_event_feed' );
function advwp_create_upcoming_event_feed() {
// Add_Feed() takes a "title" for the feed, and then a function to call
// In this case, it calls a function that just points to the new
// feed template.
add_feed( 'upcoming', 'advwp_render_upcoming_event_feed');
}
function advwp_render_upcoming_event_feed() {
<?php get_header(); ?>
<section id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php include_once('loop-event.php'); ?>
</main><!-- .site-main -->
</section><!-- .content-area -->
<?php
if ( $the_query->have_posts() ) : ?>
<header class="page-header">
<?php
the_archive_title( '<h1 class="page-title">', '</h1>' );
the_archive_description( '<div class="taxonomy-description">', '</div>' );
?>
</header><!-- .page-header -->
<?php
/**
* RSS2 Feed Template for displaying RSS2 Posts feed.
*
* @package WordPress
*/
header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
$more = 1;
<?php
if(function_exists("register_field_group"))
{
register_field_group(array (
'id' => 'acf_advwp-events',
'title' => 'ADVWP Events',
'fields' => array (
array (
'key' => 'field_5519b60c4a3fe',
'label' => 'Scheduling Options',
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> role="article" itemscope itemtype="http://schema.org/Event">
<?php
// Post thumbnail.
twentyfifteen_post_thumbnail();
?>
<header class="entry-header">
<?php
// Apply itemprop="name" to the title of the event
if ( is_single() ) :
@michaelschofield
michaelschofield / single-event.php
Created April 12, 2015 22:58
Starting Point for the `single-event` template | Adv. WP - Week Four
<?php
/**
* The template for displaying all single events. This specific template
* is based of Twentyfifteen single.php. Certain styles and Twentyfifteen-specific functions
* may not translate if used with another theme.
*/
get_header(); ?>