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
add_filter( 'query', 'mp_query_filter'); | |
function mp_query_filter($query) { | |
global $wpdb; | |
if ( preg_match( '/('. $wpdb->base_prefix .'mp_terms|'. $wpdb->base_prefix .'mp_term_relationships)/i', $query ) ) { | |
$query_after = str_replace($wpdb->base_prefix."mp_terms", $wpdb->base_prefix."terms", $query); | |
$query_after = str_replace($wpdb->base_prefix."mp_term_relationships", $wpdb->base_prefix."mp_term_relationships", $query_after); | |
// DEBUG START - This following is just for debug to check the output. This will write |
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 | |
/* | |
* Template Name: Theme Custom | |
*/ | |
?> | |
<?php | |
if ( ! current_user_can( 'edit_theme_options' ) ) { | |
?><p>You doe not have access to custom this theme</p><?php | |
} else { | |
?><iframe src="http://local.wp34.com/wp-admin/customize.php" width="800" height="800"></iframe><?php |
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 mp_js_override() { | |
global $mp; | |
if (!is_object($mp)) return; | |
// #1 - Disable AJAX on the Product page. | |
remove_action( 'template_redirect', array(&$mp, 'store_script') ); //only on front pages | |
// #2 - Deregister the MP script(s) and reregister in the footer. |
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
/* Exclude logic for MarketPress Product Categories */ | |
// Add product_categories to exclude here. Note this is an array so multiple category IDs need to be seperated by comma. Also wrapped in single quote. | |
// The minus sign is not used. You need to update the mp_excluded_categories with the slugs of your excluding categories. | |
$mp_excluded_categories = array('products'); | |
// Page ID to redirect non-logged in users when viewing a single product page associated with an excluded category | |
$mp_redirect_archive_page_id = 123; | |
// Page ID to redirect non-logged in users when viewing a product category archive for an excluded category |
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
function theme_switcher_markup( $style = 'text', $instance = array() ) { | |
if ( ! $theme_data = wp_cache_get('themes-data', 'advanced-theme-switcher') ) { | |
$themes = (array) get_themes(); | |
if (!$themes) return; | |
if ( is_multisite() ) { | |
//$allowed_themes = (array) get_site_option( 'allowedthemes' ); | |
$allowed_themes = WP_Theme::get_allowed(); |
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
/*** Add Post Date Metabox */ | |
function my_postdatemeta_init() | |
{ | |
add_meta_box('env_post_date_meta', 'Admin Meta', 'env_post_date_meta', 'post', 'normal', 'low'); | |
add_meta_box('env_post_date_meta', 'Admin Meta', 'env_post_date_meta', 'news', 'normal', 'low'); | |
add_meta_box('env_event_date_meta', 'Admin Meta', 'env_event_date_meta', 'ai1ec_event', 'normal', 'low'); | |
} | |
add_action('admin_init','my_postdatemeta_init'); |
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('admin_init','my_postdatemeta_init'); | |
add_action('save_post', 'env_save_post_date_meta', 1, 2); // save the custom fields | |
/*** Add Post Date Metabox */ | |
function my_postdatemeta_init() | |
{ | |
// Paul: The metaboarcx are really just display for the admin to check the date. Should not be seen for regular users. | |
if (get_current_user_id() == 1) { // Change the '1' to some other userID | |
// Paul: changed so all post_types use the same metabox. Don't need one just for Events. |
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
$item_output .= '<div class="live-stream-text">'; | |
/* Show the User Name */ | |
if (isset($user_data['display_name'])) | |
$item_output .= $author_anchor_begin . $user_data['display_name'] . $author_anchor_end ." "; | |
if ($item->post_type == "comment") { | |
$item_output .= __(" commented on ", LIVE_STREAM_I18N_DOMAIN); ; | |
/* Show the Post Title */ |
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
/* Simple function to show existing WordPress filters */ | |
function show_filter($filter_key='') { | |
if (empty($filter_key)) return false; | |
global $wp_filter; | |
if (isset($wp_filter[$filter_key])) { | |
foreach($wp_filter[$filter_key] as $priority => $filter_sets) { | |
echo "=== Priority [{$priority}] ===<br />"; | |
foreach($filter_sets as $filter_set_key => $filter_set_data) { | |
echo $filter_set_key."<br />"; |
OlderNewer