Skip to content

Instantly share code, notes, and snippets.

View pommiegranit's full-sized avatar

Chris Knowles pommiegranit

  • Melbourne, Australia
View GitHub Profile
@pommiegranit
pommiegranit / webhooks_action.php
Last active October 13, 2015 18:21
MailChimp webhooks for WordPress
<?php
function mcwh_action_webhook() {
$mcwh_settings = get_option( 'mcwh_settings' );
mcwh_log('==================[ Incoming Request ]==================');
// mcwh_log('Full _REQUEST dump:\n'.print_r($_REQUEST,true));
if ( empty($_POST) ) {
@pommiegranit
pommiegranit / add_placeholder.js
Last active August 29, 2015 14:09
Custom styles for PopUp Pro from WPMU Dev
jQuery('document').ready(function($){
$('input[name=subscription-email]').attr('placeholder','Enter your email address...');
});
@pommiegranit
pommiegranit / add_background_image.php
Created November 12, 2014 00:57
Make featured image background on WP posts and most recent post's featured image background on home page.
// Custom Background Images
// Use featured image on posts
// Use the most recent post's featured image on home page (or default background image)
function add_background_image() {
global $post;
if (is_admin()) return;
@pommiegranit
pommiegranit / background-shifting.js
Last active August 29, 2015 14:08
Snippets for WordPress Story creation
// build scenes for background shifting
new ScrollScene({triggerElement: 'header', duration: jQuery('header').height() + win_height})
.setClassToggle(bg_el, 'middle') // add class toggle
.addTo(controller);
new ScrollScene({offset: jQuery('#pg-1574-5').offset().top - parseInt(jQuery('#pg-1574-5').css('margin-top')) - win_height, duration: parseInt(jQuery('#pg-1574-5').css('margin-top')) + jQuery('#pg-1574-5').height()})
.setClassToggle(bg_el, 'topright') // add class toggle
.addTo(controller);
new ScrollScene({offset: jQuery('#pg-1574-6').offset().top - win_height, duration: jQuery('#pg-1574-6').height() + win_height})
@pommiegranit
pommiegranit / bgvideo_shortcode_eg.html
Last active August 29, 2015 14:06
WordPress Background Video
[bgvideo width="1280" height="720"
mp4="http://www.test.dev/wp-content/uploads/2014/09/rainier.mp4"
webm="http://www.test.dev/wp-content/uploads/2014/09/rainier.webm"
poster="http://www.test.dev/wp-content/uploads/2014/09/rainier-cover-1024x576.jpg"
fixed="no"]
@pommiegranit
pommiegranit / clientside.js
Last active August 29, 2015 14:06
Part of the enhanced comments plugin
jQuery(document).ready(function($){
// move the buried comments to the bottom of the list
if ( encom.buried == 'bottom' ) {
var comments = $(encom.comment + '.buried').detach();
$(encom.container).append( comments );
}
// remove buried comments
if ( encom.buried == 'remove' ) {
@pommiegranit
pommiegranit / slideout-comments.css
Last active August 29, 2015 14:06
Slideout Comments
.comments-wrapper {
position: fixed;
bottom: 0px;
right: -50%;
width: 51%;
background: #fff;
padding: 10px;
z-index: 10;
border-width: 1px 0 1px 1px;
border-style: solid;
[caption id="attachment_1041" align="alignnone" width="690"]
<img src="http://www.test.dev/wp-content/uploads/2013/03/spider-man-690x1024.jpg"
alt="The Amazing Spider Man" width="690" height="1024" class="size-large wp-image-1041"
data-desc-style="map"/>
Click on the spider icon to learn more about The Amazing Spider Man[/caption]
<header id="masthead" class="site-header" role="banner">
<div class="site-branding">
<h1 class="site-title"><a href="http://www.test.dev/" rel="home">My Sticky Menu</a></h1>
<h2 class="site-description">And I Don't Even Live In New York. Yet.</h2>
</div>
<nav id="site-navigation" class="main-navigation" role="navigation">
<h1 class="menu-toggle">Menu</h1>
<a class="skip-link screen-reader-text" href="#content">Skip to content</a>
<div class="menu-mobile-main-container">
<ul id="menu-mobile-main" class="menu">
@pommiegranit
pommiegranit / semantic.php
Created June 30, 2014 06:54
Switch on semantic markup options for images in WordPress
<?php
/*
Plugin Name: Semantic
Plugin URI: http://premium.wpmudev.org/blog
Description: Activate Semantic Markup options
Author: Chris Knowles
Version: 1.0
Author URI: http://twitter.com/ChrisKnowles
*/