Skip to content

Instantly share code, notes, and snippets.

View nickdavis's full-sized avatar

Nick Davis nickdavis

View GitHub Profile
@redoPop
redoPop / .gitignore
Created June 18, 2010 22:08
Template .gitignore file for WordPress projects
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
// Original code from http://www.blog.highub.com/mobile-2/a-fix-for-iphone-viewport-scale-bug/
var metas = document.getElementsByTagName('meta');
var i;
if (navigator.userAgent.match(/iPhone/i)) {
for (i=0; i<metas.length; i++) {
if (metas[i].name == "viewport") {
metas[i].content = "width=device-width, minimum-scale=1.0, maximum-scale=1.0";
}
}
@markjaquith
markjaquith / disable-plugins-when-doing-local-dev.php
Created June 24, 2011 10:24
Disables specified WordPress plugins when doing local development
<?php
/*
Plugin Name: Disable plugins when doing local dev
Description: If the WP_LOCAL_DEV constant is true, disables plugins that you specify
Version: 0.1
License: GPL version 2 or any later version
Author: Mark Jaquith
Author URI: http://coveredwebservices.com/
*/
@billerickson
billerickson / gist:1325958
Created October 30, 2011 14:29
Limit search to video
<?php
/**
* Limit Search to Video
* @author Bill Erickson
* @link http://www.billerickson.net/wordpress-search-post-type/
*
* @param string search form
* @param string search text
* @param string button text
* @return string modified search form
@billerickson
billerickson / gist:1325959
Created October 30, 2011 14:30
Variable for form
<?php
global $form_type;
$form_type = 'video';
get_search_form();
$form_type = '';
@DHS
DHS / PHP Countries Array
Created November 4, 2011 18:51
PHP array of all country names
<?php
$countries = array("Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegowina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo", "Congo, the Democratic Republic of the", "Cook Islands", "Costa Rica", "Cote d'Ivoire", "Croatia (Hrvatska)", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Island
<?php
/**
* Genesis Title Toggle - Post Formats
* If you're using Tapestry or another StudioPress theme with post formats,
* add this to your theme's functions.php file to make Genesis Title Toggle work.
*
* @author Bill Erickson
* @link http://wordpress.org/support/topic/plugin-genesis-title-toggle-title-toggle-title-remains
*/
@GaryJones
GaryJones / gist:1517555
Created December 24, 2011 15:26
Display some widgets from a sidebar in random order
<?php
add_filter( 'sidebars_widgets', 'gmj_shuffle_widgets' );
/**
* Shuffle ranges of widgets within a sidebar.
*
* Hat-tip to {@link http://gmj.to/op} for the original idea.
*
* @uses gmj_do_shuffle_widgets() Does the actual array manipulation.
*
@deckerweb
deckerweb / gist:1576203
Created January 7, 2012 22:03
Plugin: Genesis Single Post Navigation -- Customize parameters for "next post link" -- add this to functions.php of your child theme
<?php
add_filter( 'gspn_next_post_link', 'custom_gspn_next_link' );
/**
* Genesis Single Post Navigation: Add custom filters for "next post link"
*/
function custom_gspn_next_link() {
$args = array (
'format' => '%link', // Change link format (default: %link)
@roborourke
roborourke / wp-stickies.php
Created January 17, 2012 11:04
Better sticky post handling for WordPress
<?php
/**
* Fixes sticky post ordering in WordPress anywhere the order is not explicitly defined.
*
* Updates a post's menu order whenever the sticky posts option is updated
*
* Props to Simon Fransson of http://dessibelle.se/ for a bugfix where 'unstickied' posts were not updated
*
* @param Array $stickies An array of post IDs