Skip to content

Instantly share code, notes, and snippets.

View jester1979's full-sized avatar

Floris Lof jester1979

View GitHub Profile
@jester1979
jester1979 / dtap-db-config.php
Last active August 29, 2015 14:00
DTAP-database-config.php
<?php
if ( false !== stripos( $_SERVER['SERVER_NAME'], 'development' ) ) {
//development config goes here
} elseif ( false !== stripos( $_SERVER['SERVER_NAME'], 'testing' ) ) {
//testing config goes here
@jester1979
jester1979 / dtap-varaties.php
Last active August 29, 2015 14:00
DTAP-variaties.config.php
<?php
if ( false !== stripos( $_SERVER['SERVER_NAME'], 'development' ) ) {
//development
define( 'WP_DEBUG', true ); //always develop with debugging on, or you are an idiot...
define( 'WP_CACHE', false ); //no caching of any fliles please
define( 'WP_LOCAL_DEV', true ); //for usage in Mark Jaquiths plugin
define( 'JETPACK_DEV_DEBUG', true ); //use Jetpack in Dev-mode
} else {
//production
@jester1979
jester1979 / custom-config.php
Last active August 29, 2015 14:01
Use a custom-config.php which can be excluded from Git
<?php
if ( file_exists( dirname( __FILE__ ) . '/custom-config.php' ) ) {
//this handy dandy file can be excluded from your Git or SVN repo!
//so each developer can use his/her own config :-)
include( dirname( __FILE__ ) . '/custom-config.php' );
} else {
//production config goes here, example:
@jester1979
jester1979 / wp-config-defines.php
Created January 27, 2015 20:03
Some extra wp-config.php defines
define( 'WP_POST_REVISIONS', 3 ); // 3 revisions should be enough, use "false" to deactivate post revisions
define( 'AUTOSAVE_INTERVAL', 300 ); // seconds, increase to something like "9999" to `disable` autosave
define( 'EMPTY_TRASH_DAYS', 7 ); // empty trash for files longer than a week in trash, use "0" to completely deactivate trash, WP standard is 30 days
define( 'CORE_UPGRADE_SKIP_NEW_BUNDLED', true ); // skip the wp-content directory while updating, because we don't use the default themes
define( 'DISALLOW_FILE_EDIT', true ); // disable file editing in the backend
define( 'WP_DEFAULT_THEME', 'genesis' ); //On install use this theme instead of WordPress default theme
// remove header information about php version
header_remove( 'X-Powered-By' );
@jester1979
jester1979 / install.php
Last active August 29, 2015 14:14
Custom WordPress installation
if ( !function_exists('wp_install_defaults') ) :
/**
* {@internal Missing Short Description}}
*
* {@internal Missing Long Description}}
*
* @since 2.1.0
*
* @param int $user_id User ID.
*/
@jester1979
jester1979 / functions.php
Created January 27, 2015 20:09
Change contact methods
add_filter( 'user_contactmethods', 'change_contactmethods' );
/**
* Customize contact methods.
*
* @since 1.0.0
*
* @param array $contactmethods Existing contact fields.
* @return array Updated contact fields.
*/
function change_contactmethods( $contactmethods ) {
@jester1979
jester1979 / functions.php
Created January 27, 2015 20:13
Don't update theme
add_filter( 'http_request_args', 'dont_update_theme', 5, 2 );
/**
* Don't Update Theme.
*
* If there is a theme in the repo with the same name,
* this prevents WP from prompting an update.
*
* @since 1.0.0
*
* @author Mark Jaquith
@jester1979
jester1979 / functions.php
Created January 27, 2015 20:14
Set pagination base
add_action( 'init', array( $this, 'set_pagination_base' ) );
/**
* Set pagination base for NL sites.
*/
function set_pagination_base() {
if ( 'nl_NL' === get_locale() ) {
global $wp_rewrite;
if ( 'pagina' !== $wp_rewrite->pagination_base ) {
$wp_rewrite->pagination_base = 'pagina';
@jester1979
jester1979 / functions.php
Created January 27, 2015 20:16
Javascript vars
add_action( 'wp_head', 'append_header_js_vars' );
/**
* Append some handy dandy JS vars to the head
*
* Adds necessary code to start the PE-application (on document ready),
* with the WP_DEBUG boolean as a parameter.
*
* @since 1.0.0
*/
function append_header_js_vars() {
@jester1979
jester1979 / functions.php
Created January 27, 2015 20:23
IE compat header
add_filter( 'wp_headers', 'add_ie_compatibility_header' );
/**
* Disable IE compatibilty view modus.
*
* Not 100% guaranteed to have affect.
*
* @since 1.0.0
*/
function add_ie_compatibility_header( $headers ) {