Skip to content

Instantly share code, notes, and snippets.

@GaryJones
GaryJones / .htaccess
Created February 4, 2012 03:05
.htaccess performance and other improvements
# Increase the memory usage.
# If you get an error after adding this, try 64M or 32M instead.
php_value memory_limit "128M"
# Add syntax highlighting
AddType application/x-httpd-php-source .phps
# JavaScript
# Normalize to standard type (it's sniffed in IE anyways)
# tools.ietf.org/html/rfc4329#section-7.2
@danielbachhuber
danielbachhuber / gist:1819334
Created February 13, 2012 19:23
Edit Flow WP.com helper file
<?php
/**
* Don't load caps on install for WP.com. Instead, let's add
* them with the WP.com + core caps approach
*/
add_filter( 'ef_kill_add_caps_to_role', '__return_true' );
add_filter( 'ef_view_calendar_cap', function() { return 'edit_posts'; } );
add_filter( 'ef_view_story_budget_cap', function() { return 'edit_posts'; } );
add_filter( 'edit_post_subscriptions', function() { return 'edit_others_posts'; } );
add_filter( 'edit_usergroups', function() { return 'manage_options'; } );
@danielbachhuber
danielbachhuber / gist:1878875
Created February 21, 2012 20:55
Conditionally load resources based on page slug
<?php
add_action( 'wp_enqueue_scripts', 'db_conditionally_enqueue_scripts' );
function db_conditionally_enqueue_scripts() {
// Don't do anything if it's not the proper page slug
if ( !is_page( 'my-page-slug' ) )
return;
wp_enqueue_script( 'jquery' );
@lancejpollard
lancejpollard / meta-tags.md
Created March 5, 2012 13:54
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">
@kevinSuttle
kevinSuttle / meta-tags.md
Last active June 17, 2026 21:06 — forked from lancejpollard/meta-tags.md
List of Usable HTML Meta and Link Tags
@markoheijnen
markoheijnen / gist:2399898
Created April 16, 2012 16:46
Updating CDN when it is activated and the site using W3 Total cache
<?php
$cdn_activated = false;
if( function_exists( 'w3_instance' ) ) {
$cdn_activated = w3_instance('W3_Config')->get_boolean( 'cdn.enabled' );
@set_time_limit( w3_instance('W3_Config')->get_integer('timelimit.cdn_import') );
}
$upload_dir = wp_upload_dir();
$file = 'test/somefile.png';
$new_location = $upload_dir[ 'baseurl' ] . $file;
@chrisguitarguy
chrisguitarguy / kill-comments.php
Created April 25, 2012 18:57
Tell WordPress comments are closed
<?php
/*
Plugin Name: Kill Comments
Description: Return false on all `comment_status` calls
Author: Christopher Davis
Author URI: http://christopherdavis.me
License: GPL2
Copyright 2012 Christopher Davis
@markoheijnen
markoheijnen / gist:2606505
Created May 6, 2012 00:15
Cool way to include jquery from google on WordPress
<?php
class Load_External {
private $jquery_path;
private function load_external_jquery() {
global $wp_scripts;
$schema = is_ssl() ? 'https://' : 'http://';
@danielbachhuber
danielbachhuber / gist:2772004
Created May 22, 2012 22:16
Redirect to https version of the page if the shortcode is present
<?php
/**
* Redirect to the https version of the page if a particular shortcode is present
*/
add_action( 'template_redirect', 'dbx_https_redirect_if_shortcode_present' );
function dbx_https_redirect_if_shortcode_present() {
if ( !is_singular() || is_ssl() )
return;
@jdevalk
jdevalk / changelog-1.2.md
Created May 28, 2012 19:53
Changelog for WP SEO 1.2

If you want to help test, you can download the development version from here, or directly from here. If you find issues, please file them here.

= 1.2 (development version) =

Major improvements: all sorts of fixes to suggest and keyword check functionality which now should allow for non-ascii stuff, like Greek, Arabic, but even "weird" chars in western-European languages.

  • Bugs fixed:
    • ereg_replace != preg_replace ; in other words: alt and title tags for images in xml sitemap fixed.
    • Image size for OpenGraph now defaults to medium for thumbnail image.
    • Selecting a Facebook App as the admin of your site now actually works.