Skip to content

Instantly share code, notes, and snippets.

View ataylorme's full-sized avatar

Andrew Taylor ataylorme

View GitHub Profile
remove_action( 'wp_head', 'feed_links', 2 );
@include keyframe(fadeout) {
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}
@ataylorme
ataylorme / page-select-CMB-WordPress
Created June 17, 2013 15:26
Adds a page select field to Custom Metaboxes and Fields for WordPress
/* ADD PAGE SELECT FIELD */
function metabox_page_select_field( $field, $meta ) {
$args = array(
'depth' => 0,
'child_of' => 0,
'selected' => $meta,
'echo' => 1,
'name' => $field['id']
);
wp_dropdown_pages($args);
<?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' );
<?php
function add_html_pages_permalink() {
global $wp_rewrite;
if ( !strpos($wp_rewrite->get_page_permastruct(), ".html")){
$wp_rewrite->page_structure = $wp_rewrite->page_structure . ".html"; $wp_rewrite->flush_rules();
}
}//end add_html_pages_permalink
add_action('init', 'add_html_pages_permalink', -1);
function add_html_pages_no_page_slash($string, $type){
global $wp_rewrite;
<?php
/* ========== 301 REDIRECTS ========== */
function my_wordpress_301_redirects() {
/* Bail if on the front page */
if( is_front_page() )
return;
$redirect_pages = array(
/* Pass a string to redirect to a new page */
'slug1' => 'new-slug1',
'slug2' => 'new-slug2',
$slug = array_pop(array_filter(explode('/', $_SERVER["REQUEST_URI"])));
@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) {
@ataylorme
ataylorme / disable-autop-shortcodes
Created May 7, 2013 13:52
Disable WordPress autop in shortcodes
//remove wpautop from content
remove_filter( 'the_content', 'wpautop' );
//add wpautop back to content after shortcodes are processed
add_filter( 'the_content', 'wpautop' , 99);
<?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;