Skip to content

Instantly share code, notes, and snippets.

View johnregan3's full-sized avatar

John Regan johnregan3

View GitHub Profile
@johnregan3
johnregan3 / full-width-image-theme-support.php
Last active December 19, 2018 05:29
Add Full Width Image Support in a WordPress Theme - PHP
<?php
/**
* Add Theme Support for wide and full-width images.
*
* Add this to your theme's functions.php, or wherever else
* you are adding your add_theme_support() functions.
*
* @action after_setup_theme
*/
function jr3_theme_setup() {
@johnregan3
johnregan3 / genesis-custom-favicon.php
Last active November 1, 2017 22:06
Filter to add a custom favicon to your Genesis child theme.
<?php
/**
* Add custom Genesis favicon
*
* Dude, replace the default Genesis favicon so you don't look like a n00b.
* Create your custom favicon.ico and place it in your child theme's directory.
* Add this code to your child theme's functions.php
*
* Images can be converted to the .ico format here: http://www.favicon-generator.org/
@johnregan3
johnregan3 / wp-amp-tutorial-featured-images.php
Created July 21, 2016 18:13
Add Featured Images to a WordPress AMP Template
@johnregan3
johnregan3 / keybase.md
Created May 17, 2017 17:10
Keybase Verification

Keybase proof

I hereby claim:

  • I am johnregan3 on github.
  • I am johnregan3 (https://keybase.io/johnregan3) on keybase.
  • I have a public key whose fingerprint is BF11 701D 8DF1 68F1 8796 28ED A894 0B45 6721 8112

To claim this, I am signing this object:

server {
listen 80;
listen 443 ssl;
server_name local-www.network.rogersradio.ca local-www.kiss925.com local-www.sonic1029.com local-www.jackfm.com;
root /srv/www/musicradio/build/webroot;
include /etc/nginx/nginx-wp-common.conf;
}
@johnregan3
johnregan3 / wp-amp-tutorial-register-templates.php
Last active September 28, 2016 16:23
Registering a Custom Template with the WP AMP plugin
<?php
/**
* Add a custom AMP template file.
*
* Registers templates in a templates subdirectory by post type slug.
* (e.g., "./templates/book.php")
*
* @filter amp_post_template_file
*
* @param string $file The file name input.
@johnregan3
johnregan3 / wp-amp-tutorial-social-share.php
Last active September 28, 2016 16:21
Example AMP Social Share buttons in WordPress
<?php
/*
* Example of using amp-social-share within WP.
*
* Note that Facebook requires an App ID {YOUR_FB_APP_ID}.
*
* Be sure to include the amp-social-share component script.
*/
<div class="share-buttons">
<amp-social-share type="facebook" width="32" height="32"
<?php
/**
* Add custom AMP template files.
*
* Registers templates in a /templates subdirectory.
*
* @filter amp_post_template_file
*
* @param string $file The file name input.
* @param string $type The type of template.
@johnregan3
johnregan3 / amp-check-for-plugin.php
Last active September 28, 2016 16:04
Admin notice if the WP AMP Plugin is not installed.
<?php
/**
* Show an Admin Notice if the AMP plugin is not found.
*
* This is a basic implementation. Naturally, you'll want
* to add ajax support so that once this is dismissed, it goes
* away permanently. Also, you may want to limit the admin
* pages this displays to prevent annoying your users.
*
* @return bool
@johnregan3
johnregan3 / wp-amp-tutorial-component-scripts.php
Last active September 28, 2016 16:03
Add component scripts to WP AMP
<?php
/**
* Register the amp-sidebar and amp-accordion component scripts with WP AMP.
*
* This goes in your amp.php
*/
function jr3_amp_component_scripts( $data ) {
$data['amp_component_scripts']['amp-sidebar'] = 'https://cdn.ampproject.org/v0/amp-sidebar-0.1.js';
$data['amp_component_scripts']['amp-accordion'] = 'https://cdn.ampproject.org/v0/amp-accordion-0.1.js';