Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris Knowles pommiegranit

  • Melbourne, Australia
View GitHub Profile
@pommiegranit
pommiegranit / webhooks_action.php
Last active Oct 13, 2015
MailChimp webhooks for WordPress
View webhooks_action.php
<?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 Aug 29, 2015
Custom styles for PopUp Pro from WPMU Dev
View add_placeholder.js
jQuery('document').ready(function($){
$('input[name=subscription-email]').attr('placeholder','Enter your email address...');
});
@pommiegranit
pommiegranit / mywidget-basic.php
Last active Aug 30, 2018
Playing with WordPress widgets
View mywidget-basic.php
<?php
/*
Plugin Name: My Widget
Plugin URI: http://mydomain.com
Description: My first widget
Author: Me
Version: 1.0
Author URI: http://mydomain.com
*/
@pommiegranit
pommiegranit / add_background_image.php
Created Nov 12, 2014
Make featured image background on WP posts and most recent post's featured image background on home page.
View add_background_image.php
// 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 Aug 29, 2015
Snippets for WordPress Story creation
View background-shifting.js
// 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 / fullpage_apple.css
Last active Nov 2, 2020
fullPage.js For WordPress
View fullpage_apple.css
/* Style for header texts
* --------------------------------------- */
h1{
font-size: 5em;
font-family: arial,helvetica;
margin:0;
padding:0;
}
h2{
font-size: 2em;
@pommiegranit
pommiegranit / bgvideo_shortcode_eg.html
Last active Aug 29, 2015
WordPress Background Video
View bgvideo_shortcode_eg.html
[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 Aug 29, 2015
Part of the enhanced comments plugin
View clientside.js
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 / gestures_init.js
Created Sep 8, 2014
Initialization script for Tocca js in WordPress
View gestures_init.js
jQuery(document).ready(function($){
$(gestures.container).on('dbltap', function(){
jQuery(location).attr('href', gestures.destination );
}
).on('swipeleft', function() {
View slideout-comments.css
.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;