Skip to content

Instantly share code, notes, and snippets.

@bearded-avenger
bearded-avenger / easy-digital-downloads-changelog-shortcode
Last active October 19, 2020 07:06
Easy Digital Downloads - Changelog Shortcode (pass the EDD download ID and output a button that opens the changelog in a lightbox) - Completely un-styled and ready to abuse
/*
Use: [changelog id=""]
Atts: "id" is the id of the download in EDD
*/
add_shortcode('changelog','edd_changelog_sc'));
function edd_changelog_sc($atts,$content = null) {
$defaults = array(
@bearded-avenger
bearded-avenger / gist:6540945
Last active December 22, 2015 22:38
Last Updated Shortcode
add_shortcode('last_updated','53fh26_lastupdated');
function 53fh26_lastupdated($atts,$content = null){
$updated = get_the_modified_date('F j, Y');
$out = sprintf('<p class="last-updated">Last Updated: %s</p>',$updated);
return $out;
}
// Usage
@bearded-avenger
bearded-avenger / long-form-helper.php
Last active December 24, 2015 08:39
Long Form Helper - Plugin
<?php
/*
Author: Nick Haskins
Author URI: http://nickhaskins.co
Plugin Name: Long Form Helper
Plugin URI: http://nickhaskins.co
Version: 1.0
Description: A helper plugin for long posts by introducing a "scroll to" floating panel.
*/
@bearded-avenger
bearded-avenger / style.less
Created October 1, 2013 00:48
Long Form Helper - style.less file - goes with https://gist.github.com/bearded-avenger/6772441
.article-wrap {
position: relative;
}
.scroll-nav {
}
.scroll-nav{
@size: 12px;
@bg: @baseContrastSlight;
@bearded-avenger
bearded-avenger / edd-settings-example.php
Last active January 15, 2016 21:03
This sample class shows how 3rd party devs can add a tab to Easy Digital Downloads wp-admin settings tab, along with how to use the EDD Settings API. NOW AS A REPO https://github.com/bearded-avenger/edd-settings-api-sample
<?php
class sampleClass {
function __construct() {
add_filter( 'edd_settings_tabs', array($this,'test_tab' ));
add_action('admin_init', array($this,'edd_register_settings_test'));
}
@bearded-avenger
bearded-avenger / 0_reuse_code.js
Created November 4, 2013 22:34
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
$meta_boxes[] = array(
'title' => __('Flacker Front Page Meta', 'fotos'),
'pages' => 'page',
'show_on' => array( 'page-template' => 'front-page.php' ),
'fields' => array(
array(
'id' => 'flacker_info_module',
'name' => __('Info Module', 'flacker'),
'type' => 'group',
'repeatable' => true,
@bearded-avenger
bearded-avenger / sharedcounts.php
Created December 19, 2013 16:04
Get total share counts of a Wordpress post and cache with transient.
function aesop_share_count(){
$post_id = get_the_ID();
//$url = 'http://nickhaskins.co'; // this one used for testing to return a working result
$url = get_permalink();
$apiurl = sprintf('http://api.sharedcount.com/?url=%s',$url);
@bearded-avenger
bearded-avenger / sslcontrol.php
Created December 19, 2013 16:41
Do SSL only on checkout page in Wordpress.
<?php
/**
* SSL Controls
*/
class flackerSSLControl {
function __construct(){
add_action( 'template_redirect', array($this,'url_change' ),1);
@bearded-avenger
bearded-avenger / Gruntfile.js
Last active January 2, 2016 21:29
CG Cookie GruntFile
'use strict';
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
// watch our project for changes
watch: {
compass: {