Skip to content

Instantly share code, notes, and snippets.

<?php
class StephanisAddition {
public static function add_two_numbers( $number_one, $number_two ) {
if ( ! is_numeric( $number_one ) || ! is_numeric( $number_two ) ) {
return null;
}
return $number_one + $number_two;
}
INITIALISATION
==============
load wp-config.php
set up default constants
load wp-content/advanced-cache.php if it exists
load wp-content/db.php if it exists
connect to mysql, select db
load object cache (object-cache.php if it exists, or wp-include/cache.php if not)
load wp-content/sunrise.php if it exists (multisite only)
@wokamoto
wokamoto / post_meta_transient.php
Last active June 16, 2016 16:36
[WordPress] post meta transient
<?php
/**
* Delete a post meta transient.
*/
function delete_post_meta_transient( $post_id, $transient, $value = null ) {
global $_wp_using_ext_object_cache;
$post_id = (int) $post_id;
do_action( 'delete_post_meta_transient_' . $transient, $post_id, $transient );
@stompweb
stompweb / pagination.php
Created June 28, 2012 19:05
WordPress Pagination
<div id="content">
<h1>Ice Creams</h1>
<?php
$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
$args = array(
'posts_per_page' => 5,
@necolas
necolas / .htaccess
Created April 9, 2012 22:19
Simple, quick way to concatenate, minify, and version static files in a Wordpress theme
# Filename-based cache busting
# taken from https://github.com/h5bp/html5-boilerplate/
# This rewrites file names of the form `name.123456.js` to `name.js`
# so that the browser doesn't use the cached version when you have
# updated (but not manually renamed) the file.
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On