Skip to content

Instantly share code, notes, and snippets.

View philipdowner's full-sized avatar

Philip Downer philipdowner

View GitHub Profile
@chuckreynolds
chuckreynolds / Wordpress .HTACCESS file
Created June 25, 2009 06:39
Hardened .htaccess file for WP installs
# canonical redirect to no www
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
# protect wp-config at all cost
<files wp-config.php>
Order deny,allow
deny from all
</files>
@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
@awshout
awshout / foundation3-navbar-menu.php
Last active October 13, 2021 17:07
WordPress Menu & Walker for ZURB's Foundation 3 Nav Bar
<?php
add_theme_support('menus');
/*
http://codex.wordpress.org/Function_Reference/register_nav_menus#Examples
*/
register_nav_menus( array(
'main-menu' => 'Main Menu' // registers the menu in the WordPress admin menu editor
) );
@planktonWD
planktonWD / wp_install_default.sh
Created November 12, 2012 04:08 — forked from hansipete/wp_install_default.sh
Default Install Script for WordPress Setup on MAMP localhost
#!/bin/bash
##############################
# DEFAULT WORDPRESS AND PLUGIN INSTALL SCRIPT
#
# 2012-04-03
# 1.0
# TODO: PUT A YES/NO PROMPT BEFORE RUNNING SCRIPT
# !!!!! EXITS UNLESS YOU MANUALLY COMMENT OUT THE LINE BELOW
# exit

Contract

[Client ID] [Project/Service ID] [Contract ID] [Date]

Between me, Andrew Watson and you, [Client Name], referred to throughout this document as me or I and you or your respectively.

Summary

<?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.1
License: GPL version 2 or any later version
Author: Mark Jaquith
Author URI: http://coveredwebservices.com/
*/
@szbl
szbl / wp-singleton-namespace-example.php
Last active December 21, 2018 05:56
Quick Singleton class to be included in WordPress plugin (or theme functions.php file) that will create a simple Person post type and shows some methods of encapsulating functionality in a class as a "namespace," as well as applying filters to things, allowing other users to extend your code.
<?php
class Sizeable_Person
{
const POST_TYPE_SLUG = 'szbl-person';
public static $instance;
public static function init()
{
if ( is_null( self::$instance ) )
@szbl
szbl / my-plugin-snippet.php
Last active March 15, 2022 04:17
How I auto-include my library of "controllers" in a theme/plugin.
<?php
// include all PHP files in ./lib/ directory:
foreach ( glob( dirname( __FILE__ ) . '/lib/*.php' ) as $file )
include $file;
@szbl
szbl / meta.php
Created July 4, 2013 02:59
Example view from faux MVC WordPress plugin example for CodePoet.com article.
<table class="form-table">
<tbody>
<tr>
<th>
<label for="szbl-person-email">
Email Address:
</label>
</th>
<td>
<input type="email" id="szbl-person-email" name="szbl_person_email" value="<?php