Skip to content

Instantly share code, notes, and snippets.

Avatar

Kristen Symonds kristarella

View GitHub Profile
@mfields
mfields / theme-options.php
Created Jan 31, 2013
Sample theme options page for WordPress Themes.
View theme-options.php
<?php
/**
* _s Theme Options
*
* @package _s
* @since _s 1.0
*/
/**
* Register the form setting for our _s_options array.
@mattonomics
mattonomics / gist:4079235
Created Nov 15, 2012
New html method parameter
View gist:4079235
<?php
/*
Name: Box Name
Author: Author Name
Description: A good description of this box
Version: Box version
Class: box_class_with_underscore
*/
class box_class_with_underscore extends thesis_box {
@webercoder
webercoder / wp-author-import-auto-select.js
Created Jun 4, 2012
Auto-select authors for posts during WordPress import. They must already be assigned to the project. Enable jQuery in a plugin or functions.php, and paste this in the browser console.
View wp-author-import-auto-select.js
(function($){
$('#authors li').each(function(key, value) {
var name = $(this).children('strong').first().html();
var re = /\s\([^\)]+\)/gi;
name = name.replace(re, '');
$(this).find('select').first().children('option').each(function(){
if ($(this).html() == name) {
console.log('Comparing ' + $(this).html() + ' to ' + name + ".\n");
$(this).attr('selected', 'selected');
@jonathanmoore
jonathanmoore / gist:2640302
Created May 8, 2012
Get the share counts from various APIs
View gist:2640302

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@billerickson
billerickson / gist:1888923
Created Feb 23, 2012
Popular Posts Widget
View gist:1888923
<?php
/**
* Popular Posts Widget
*
* Displays posts in last X days, sorted by most comments (proxy for popularity)
*
* @package Core Functionality
* @author Bill Erickson <bill@billerickson.net>
* @copyright Copyright (c) 2011, Bill Erickson
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
You can’t perform that action at this time.