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 | |
define( 'LIVE_URL', 'http://yoursite.com') | |
// add_action('init', 'my_replace_image_urls' ); | |
function my_replace_image_urls() { | |
$site_url = get_site_url(); | |
if ( false !== strpos( $site_url, '.dev' ) ){ | |
add_filter( 'wp_get_attachment_url', 'replace_dev_url', 10, 2 ); | |
add_filter( 'wp_calculate_image_srcset', 'replace_dev_url_srcset', 10, 2 ); | |
} | |
} |
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 mck_replace_footer_text( $text ){ | |
if ( 'Designed by %1$s | Powered by %2$s' === $text ) { | |
$text = '© ' . date('Y') . ' ' . get_bloginfo( 'name' ) . '. All rights reserved.'; | |
} | |
return $text; | |
} | |
add_filter( 'gettext', 'mck_replace_footer_text' ); |
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 | |
add_action( 'rest_api_init', 'spe_register_api_hooks' ); | |
function spe_register_api_hooks() { | |
$namespace = 'simple-posts/v1'; | |
register_rest_route( $namespace, '/list-posts/', array( | |
'methods' => 'GET', | |
'callback' => 'spe_get_posts', | |
) ); | |
} | |
function spe_get_posts() { |
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 | |
/* | |
Plugin Name: Rich Text editors for Gravity Forms | |
Description: Converts the textarea fields in Gravity Forms to WordPress rich text editors | |
Author: Nathaniel Taintor | |
Author URI: http://goldenapplesdesign.com | |
Version: 1.0 | |
License: GPLv2 | |
*/ | |
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); |