This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('wp_ajax_action_name', 'callback_function'); | |
add_action('wp_ajax_nopriv_action_name', 'callback_function'); | |
function callback_function() { | |
echo 'stuff to return'; | |
die(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Function to insert an administrator login into a WordPress site. | |
* Login and email have to be unique, the function doesn't update existing accounts. | |
* Function should be placed in functions.php of the active theme. | |
*/ | |
function insert_admin(){ | |
$login = ''; // username goes here. | |
$passw = ''; // password goes here, will be hashed on creation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# save space, and grab uploads from the live site | |
location /wp-content/uploads/ { | |
if (!-e $request_filename){ | |
rewrite ^/wp-content/uploads/(.*) http://yourlivesite.com/wp-content/uploads/$1 redirect; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// limit number of categories a person can have | |
add_filter('wp_terms_checklist_args', 'digsublime_select_one_category'); | |
function digsublime_select_one_category($args) { | |
if (isset($args["taxonomy"]) && $args["taxonomy"] == ("lodge" || "chapter" || "section") ) { //put taxonomies to apply this to in quotes | |
$args["walker"] = new Walker_Category_Radios; | |
$args["checked_ontop"] = false; | |
} | |
return $args; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// QA NAVIGATION | |
//REMOVE ME BEFORE PUBLISHING | |
$("body").append(' <div id="qanav" style="position: fixed; bottom: 5px; left: 5px; font-size: 12px; z-index:999999999999;"> '+ | |
'<select>'+ | |
'<option value="#" default>QA Nav - Select a Page</option>'+ | |
'<option value="index.html">Home</option>'+ | |
'<option value="browse-by-spf.html">Browse By SPF</option>'+ | |
'<option value="product-detail.html">Product Detail</option>'+ | |
'<option value="products-sport-protection.html">Prodcuts - Sport Protection</option>'+ | |
'<option value="products-tanning.html">Products - Tanning</option>'+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Add Slug to Menu as Class | |
function add_slug_class_to_menu_item($output){ | |
$ps = get_option('permalink_structure'); | |
if(!empty($ps)){ | |
$idstr = preg_match_all('/<li id="menu-item-(\d+)/', $output, $matches); | |
foreach($matches[1] as $mid){ | |
$id = get_post_meta($mid, '_menu_item_object_id', true); | |
$slug = basename(get_permalink($id)); | |
$output = preg_replace('/menu-item-'.$mid.'">/', 'menu-item-'.$mid.' menu-item-'.$slug.'">', $output, 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function migrate_db_admin_bar($wp_admin_bar){ | |
$args = array( | |
'id' => 'wp-migrate-db-pro', | |
'title' => 'Migrate DB Pro', | |
'href' => '/wp-admin/tools.php?page=wp-migrate-db-pro', | |
'meta' => array( | |
'class' => 'wp-migrate-db-pro-button' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* TypeKit Fonts | |
* | |
* @since Theme 1.0 | |
*/ | |
function theme_typekit() { | |
wp_enqueue_script( 'theme_typekit', '//use.typekit.net/hjy0hsn.js'); | |
} | |
add_action( 'wp_enqueue_scripts', 'theme_typekit' ); | |
function theme_typekit_inline() { |