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
/** | |
* Custom tab | |
*/ | |
add_filter( 'woocommerce_product_tabs', 'ct_custom_tab' ); | |
function ct_custom_tab( $tabs ) { | |
// Adds the new tab | |
$tabs['test_tab'] = array( | |
'title' => __( 'Custom Tab', 'woocommerce' ), | |
'priority' => 50, |
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
// Different menus to logged in users | |
function md_nav_menu_args( $args = '' ) { | |
if( is_user_logged_in() ) { | |
// Menu for logged users | |
$args['menu'] = 22; | |
} else { | |
// Menu for non-logged users | |
$args['menu'] = 23; | |
} |
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
// Remove meta generator tag | |
function no_generator() { return '<meta name="generator" content="FrontPage 4.0">'; } | |
add_filter( 'the_generator', 'no_generator' ); |
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
// Remove meta generator tag | |
function no_generator() { return ''; } | |
add_filter( 'the_generator', 'no_generator' ); |
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
//Remove version strings from CSS and JS link hrefs | |
function ct_remove_version_strings( $src ) { | |
global $wp_version; | |
parse_str(parse_url($src, PHP_URL_QUERY), $query); | |
if ( !empty($query['ver']) && $query['ver'] === $wp_version ) { | |
$src = remove_query_arg('ver', $src); | |
} | |
return $src; | |
} |
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
// Change logo url on WordPress login page | |
add_filter( 'login_headerurl', 'custom_loginlogo_url' ); | |
function custom_loginlogo_url($url) { | |
return 'https://madlon.eu'; | |
} |
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
// Change logo on login page | |
function my_custom_login_logo() { | |
echo '<style type="text/css"> | |
h1 a { background-image:url(https://your-domain.com/wp-content/uploads/custom-logo.png) !important; } | |
</style>'; | |
} | |
add_action('login_head', 'my_custom_login_logo'); |
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
/** | |
* Rename product data tabs | |
*/ | |
add_filter( 'woocommerce_product_tabs', 'woo_rename_tabs', 98 ); | |
function woo_rename_tabs( $tabs ) { | |
// Rename the description tab | |
$tabs['description']['title'] = __( 'More Information' ); | |
// Rename the reviews tab |
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
// shortcode for Login/register vs Logout | |
function md_login_logout() { | |
if ( is_user_logged_in()) { | |
$link = '<a href="' . wp_logout_url() . '">Logout</a>'; | |
} | |
if ( !is_user_logged_in()) { | |
$link = '<a href="/my-account/edit-account/">Login/Register</a>'; | |
} | |
return $link; | |
} |
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
// redirect to home after login/logout | |
add_action('wp_logout','go_home'); | |
function go_home(){ | |
wp_redirect( home_url() ); | |
exit(); | |
} | |
add_action('wp_login','go_home_after_login'); | |
function go_home_after_login(){ | |
wp_redirect( home_url() ); |
NewerOlder