Last active
September 12, 2015 18:47
-
-
Save ioniacob/c22566cb70d7bf783b59 to your computer and use it in GitHub Desktop.
Personal Wordpress functions.php
This file contains hidden or 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
// Additional Functions | |
// ============================================================================= | |
add_action( 'affwp_process_register_form', 'affwp_custom_process_register_form' ); | |
/* Auto enables the "Enable New Referral Notifications" checkbox on the "Settings" tab of the affiliate area when an affiliate is added. */ | |
function affwp_custom_auto_enable_affiliate_referral_notifications( $add ) { | |
update_user_meta( affwp_get_affiliate_user_id( $add ), 'affwp_referral_notifications', true ); | |
} | |
add_action( 'affwp_insert_affiliate', 'affwp_custom_auto_enable_affiliate_referral_notifications' ); | |
/** Adds a log out link to the top of the affiliate area */ | |
function affwp_custom_affiliate_dashboard_logout() { | |
$redirect = function_exists( 'affiliate_wp' ) ? affiliate_wp()->login->get_login_url() : ''; | |
?> | |
<p style="float: right;" class="x-btn x-btn-yellow-transparent x-btn-transparent x-btn-pill x-btn-mini"> | |
<a href="<?php echo wp_logout_url( $redirect ); ?>" title="Cerrar sesión"><i class="x-icon x-icon-sign-out" style="font-size: 14px;color: #F8555E;"></i>Salir</a> | |
</p><br><br> | |
<?php } | |
add_action( 'affwp_affiliate_dashboard_top', 'affwp_custom_affiliate_dashboard_logout' ); | |
/*Delete notification "Install the WooThemes Updater plugin..." alert on Dashboard" */ | |
remove_action( 'admin_notices', 'woothemes_updater_notice' ); | |
/*Hacemos que las paginas privadas redireccione a la home*/ | |
function __intercept_private_page( $posts, &$wp_query ) | |
{ | |
// remove filter now, so that on subsequent post querying we don't get involved! | |
remove_filter( 'the_posts', '__intercept_private_page', 10, 1020, 1014, 1123, 1299, 1234, 984, 1592 ); | |
if ( !( $wp_query->is_page && empty($posts) ) ) | |
return $posts; // bail, not page with no results | |
// if you want to explicitly check it *is* private, use the code block below: | |
/* | |
if ( !empty( $wp_query->query['page_id'] ) ) | |
$page = get_page( $wp_query->query['page_id'] ); | |
else | |
$page = get_page_by_path( $wp_query->query['pagename'] ); | |
if ( $page && $page->post_status == 'private' ) { | |
// redirect | |
} | |
*/ | |
// otherwise assume that if the request was for a page, and no page was found, it was private | |
wp_redirect( home_url(), 301 ); | |
exit; | |
} | |
is_admin() || add_filter( 'the_posts', '__intercept_private_page', 10, 1020, 1014, 1123, 1299, 1234, 984, 1592 ); | |
// Remove All Yoast HTML Comments | |
if (defined('WPSEO_VERSION')){ | |
add_action('get_header',function (){ ob_start(function ($o){ | |
return preg_replace('/\n?<.*?yoast.*?>/mi','',$o); }); }); | |
add_action('wp_head',function (){ ob_end_flush(); }, 999); | |
//Desactivar soporte de Emojis | |
remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); | |
remove_action( 'wp_print_styles', 'print_emoji_styles' ); | |
//Desactivar soporte y estilos de Emojis | |
remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); | |
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' ); | |
remove_action( 'wp_print_styles', 'print_emoji_styles' ); | |
remove_action( 'admin_print_styles', 'print_emoji_styles' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment