Skip to content

Instantly share code, notes, and snippets.

View ataylorme's full-sized avatar

Andrew Taylor ataylorme

View GitHub Profile
<?php
if (isset($_POST['environment'])){
$req = pantheon_curl('https://api.live.getpantheon.com/sites/self/settings', NULL, 8443);
$meta = json_decode($req['body'], true);
if($meta['allow_cacheserver'] != 1){
$req = pantheon_curl('https://api.live.getpantheon.com/sites/self/settings', '{"allow_cacheserver":true}', 8443, 'PUT');
}
}
add_theme_support( 'typecase', array(
// array of simple options
'simple' => array(
// each array is an option
// these options are displayed in the main theme fonts panel section
array(
// the label displayed in customizer
'label' => 'Body Copy',
// the CSS selector to apply the font to
'selector' => 'body',
@include keyframe(fadeout) {
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}
<?php
add_action( 'wp_enqueue_scripts', 'enqueue_my_styles' );
function enqueue_my_styles() {
global $wp_styles;
// Load the main stylesheet
wp_enqueue_style( 'my-theme', get_template_directory_uri() . '/style.css' );
@mixin boxit ($dir) {
display:box;
display:-moz-box;
display:-webkit-box;
box-orient:$dir;
-moz-box-orient:$dir;
-webkit-box-orient:$dir;
}
@mixin order ($num) {
<?php
if ( ! function_exists( 'shortcode_exists' ) ) :
/**
* Check if a shortcode is registered in WordPress.
*
* Examples: shortcode_exists( 'caption' ) - will return true.
* shortcode_exists( 'blah' ) - will return false.
*/
function shortcode_exists( $shortcode = false ) {
global $shortcode_tags;
<?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
) );
/* ========== 410 TERMINATED EMPLOYEE PAGES =========== */
function 410_status_header(){
$terminatedEmployees = array('employee-1','employee-2','employee-3','employee-4','employee-5','employee-6','employee-7','employee-8', 'employee-9', 'employee-10');
$currentURL = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$currentURL = rtrim(rawurldecode( $currentURL ), '/');
foreach( $terminatedEmployees as $terminatedEmployee ):
if( get_bloginfo('url') . '/' . $terminatedEmployee === $currentURL ):
status_header( 410 );
if( !locate_template( '410.php', true ) )
echo 'Sorry, the page you requested has been permanently removed.';