Skip to content

Instantly share code, notes, and snippets.

@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/
*/
@GaryJones
GaryJones / functions.php
Last active August 25, 2018 11:44
Conditionally add IE style sheets in WP
<?php
add_action( 'wp_print_styles', 'child_add_ie7_style_sheet', 200 );
/**
* Enqueue an IE-specific style sheet (for all browsers).
*
* @author Gary Jones
* @link https://garyjones.io/ie-conditional-style-sheets-wordpress
*/
function child_add_ie7_style_sheet() {
@fjarrett
fjarrett / gist:2653299
Last active October 4, 2015 14:28
Add prefixes to WordPress post types when a theme is activated
<?php
/* Checks to see if new post type names (with prefixes) are being used. If not, then the old
* post type names are converted as long as there aren't conflicting post type names that are
* being registered by other plugins.
*
* @hook {action} after_setup_theme
*/
function fjarrett_prefix_post_types(){
global $wpdb;
@johnpbloch
johnpbloch / README.md
Created August 23, 2012 13:55
A bash script to make .pot files for WordPress plugins

Installation

To install, you need to have the WordPress i18n library on your computer. Check it out using SVN:

sudo svn co http://i18n.svn.wordpress.org/tools/trunk/ /usr/lib/wpi18n

You don't have to put the library in /usr/lib/wpi18n, but if you don't put it there, make sure to set the $WP_I18N_LIB environment variable in your .bashrc file (with no trailing slash):

export WP_I18N_LIB="/path/to/i18n/lib"

@jgoyon
jgoyon / menu.html
Created November 1, 2012 12:02
Horizontal menu, full width sub menu
<div id="menu">
<ul id="nav">
<li><a href="#">Menu 1</a>
<ul>
<li><a href="#">Menu 1 Submenu item 1</a></li>
<li><a href="#">Menu 1 Submenu item 2</a></li>
<li><a href="#">Menu 1 Submenu item 3</a></li>
</ul>
</li>
@wpscholar
wpscholar / functions.php
Last active March 1, 2021 13:26
Enqueueing IE conditional stylesheets in WordPress the right way
<?php
add_action( 'wp_enqueue_scripts', 'enqueue_my_styles' );
/**
* Example callback function that demonstrates how to properly enqueue conditional stylesheets in WordPress for IE.
* IE10 and up does not support conditional comments in standards mode.
*
* @uses wp_style_add_data() WordPress function to add the conditional data.
* @link https://developer.wordpress.org/reference/functions/wp_style_add_data/
@brichards
brichards / sb-github-downloads.php
Last active February 16, 2021 17:10
StartBox GitHub Download Generator
<?php
/**
* Plugin Name: StartBox GitHub .zip Generator
* Description: Generates a .zip download for StartBox from GitHub Master.
*
* @props Konstantin Kovshenin (@kovshenin) for sharing his work used on underscores.me (http://code.svn.wordpress.org/underscoresme/plugins/underscoresme-generator/underscoresme-generator.php)
*/
class SB_Download_Generator {
@ecos
ecos / FTP Upload and URL in Clipboard
Created March 19, 2013 15:13
A cool Windows batch script to upload a file to an FTP folder, and then copy the URL in the clipboard. Useful for posting screenshots quickly in a post on a forum. You only have to change these parameters SET Server=yourFTPserver SET UserName=yourFTPusername SET Password=yourpassword SET RemoteFolder=/www/images/screenshots SET ClipboardURLPrefi…
@ECHO OFF
ECHO Upload to FTP
ECHO Written by: Jason Faulkner
ECHO SysadminGeek.com
ECHO. Improved by ecos
ECHO.
REM Usage:
REM UploadToFTP [/L] FileToUpload
REM
@Rarst
Rarst / composer.json
Last active January 27, 2023 12:40
Test project for WordPress stack via Composer
{
"name" : "rarst/install-test",
"description" : "Test project for WordPress stack via Composer",
"authors" : [
{
"name" : "Andrey Savchenko",
"homepage": "http://www.Rarst.net/"
}
],
"type" : "project",
@kingkool68
kingkool68 / Seamless Git Deployment
Last active December 17, 2015 05:09
To push code changes to text servers I do this.
We have a private Git running on a server somewhere which we consider our central repository. Inside the .git/hooks/post-recieve is the following:
#!/bin/bash
while read oldrev newrev ref
do
branch=`echo $ref | cut -d/ -f3`
if [ "master" == "$branch" ]; then