Skip to content

Instantly share code, notes, and snippets.

@boogah
boogah / .htaccess
Created February 16, 2012 04:59
Expire headers .htaccess code.
<IfModule mod_expires.c>
ExpiresActive on
# Perhaps better to whitelist expires rules? Perhaps.
ExpiresDefault "access plus 1 month"
# Data
ExpiresByType text/xml "access plus 0 seconds"
ExpiresByType application/xml "access plus 0 seconds"
ExpiresByType application/json "access plus 0 seconds"
<?php
/**
* The template used for displaying page content in page.php
*
* @package WordPress
* @subpackage Twenty_Eleven
* @since Twenty Eleven 1.0
*/
?>
@nfreear
nfreear / git-hook_pre-commit_lint.php
Last active October 15, 2015 04:05
Git pre-commit hook to run PHP lint, check for [CR] Mac-only line endings..
#!/C/xampp/php/php
<?php
#!/usr/bin/env php
/**
* Git pre-commit hook to run php lint.
*
* Git hooks on Windows: Ensure that the path to PHP is added to the %PATH% variable, and run `git commit` via the Bash shell.
*
* @copyright 2012-04-30 N.D.Freear.
* @license MIT
@billerickson
billerickson / gist:3379905
Created August 17, 2012 15:30
WordPress Security
WordPress is actually one of the most secure pieces of software available. It powers 17%
of the 1,000,000 most visited websites, so it is being constantly tested both internally
and by hackers. When an issue is discovered, an update is released which you can install
with one click in the dashboard.
The vast majority of hacked WordPress websites are running an out-of-date version of
WordPress. Once WordPress is updated, any vulnerabilities that are patched are now publicly
known, so old versions are vulnerable.
The next most likely source of hacking is your host. If your server isn't secure, it doesn't
@clarklab
clarklab / gist:3902885
Created October 17, 2012 00:01
get_theme_mod
<!-- in footer.php -->
<div class="footer-text"><?php echo get_theme_mod('footer_text') ?></div>
<!-- rendered HTML content -->
<div class="footer-text">&copy;2012 Site Name</div>
<!--in functions.php (to enable the field in the Theme Customizer) -->
<?php
@billerickson
billerickson / archive.php
Last active October 13, 2015 10:08
Genesis Grid - change length of content in grid
<?php
/**
* Grid Content
* Change the number of words in excerpt if in the grid loop
*/
function be_grid_content() {
// First, we make sure we're in the grid loop.
if( ! apply_filters( 'is_genesis_grid_loop', false ) )
return;
@norcross
norcross / login-string-check.php
Created December 20, 2012 01:15
check login URL for specific query string
<?php
/*
* Check the URL of the WordPress login
* page for a specific query string
*
* assumes login string is
* http://mysite.com/wp-login.php?question=answer
*/
function rkv_login_stringcheck() {
@clarklab
clarklab / transient-example.php
Created January 30, 2013 20:00
Caching a simple API call using the WP Transient API
<?php
//let's get some tweets!!
//first, let's see if I've got the data already cached
$tweets = get_transient("tweets");
//dang it! it looks like I might not. let's grab some tweets from the Twitter API
if( !$tweets ) {
@petenelson
petenelson / gga-marketing-request.php
Last active March 25, 2018 21:51
WordPress: Expands upon the Custom Meta Boxes library to provide a user-facing input form, list and detail page of submitted forms for custom post types.
<?php
/*
Author: Pete Nelson @GunGeekATX
Expands upon the Custom Meta Boxes library to provide a user-facing input form,
list & detail page of custom post types. This code sample doesn't include all the libraries
such as jQuery tablesorter or validate but can be found elsewhere easily enough.
*/
@robneu
robneu / wp-config
Created February 26, 2013 20:48
Set your GF license key in wp-config
/** Define Gravity Forms License Key */
define("GF_LICENSE_KEY", "YOUR-LICENSE-KEY-HERE");