Last active
May 23, 2016 11:28
-
-
Save swest/5797518 to your computer and use it in GitHub Desktop.
Custom Login & Shortcodes: add custom login stylesheet, change logo link and link URL. Snippet for functions.php, use with style-login.css
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 | |
/* Shortcodes in Widget text & titles */ | |
add_filter( 'widget_text', 'shortcode_unautop'); | |
add_filter( 'widget_text', 'do_shortcode'); | |
add_filter( 'widget_title', 'shortcode_unautop'); | |
add_filter( 'widget_title', 'do_shortcode'); | |
/* Additional Shortcodes */ | |
add_shortcode('url','url_shortcode'); | |
add_shortcode('template-url', 'template_shortcode'); | |
add_shortcode('stylesheet-directory', 'stylesheet_shortcode'); | |
add_shortcode('site-name', 'sitename_shortcode'); | |
function url_shortcode($atts) { | |
return get_bloginfo('url'); | |
} | |
function template_shortcode($atts) { | |
return get_bloginfo('template_url'); | |
} | |
function stylesheet_shortcode($atts) { | |
return get_bloginfo('stylesheet_directory'); | |
} | |
function sitename_shortcode($atts) { | |
return get_bloginfo('name'); | |
} | |
// Custom login | |
// http://codex.wordpress.org/Customizing_the_Login_Form#Change_the_Login_Logo | |
function sw_login_stylesheet() { | |
wp_enqueue_style( 'custom-login', get_stylesheet_directory_uri() . '/style-login.css' ); | |
} | |
add_action( 'login_enqueue_scripts', 'sw_login_stylesheet' ); | |
function sw_login_logo_url() { | |
return get_bloginfo( 'url' ); | |
} | |
add_filter( 'login_headerurl', 'sw_login_logo_url' ); | |
function sw_login_logo_url_title() { | |
// return 'Site Name'; | |
// return 'echo do_shortcode( '[site-name]' )'; | |
return get_bloginfo('name'); | |
} | |
add_filter( 'login_headertitle', 'sw_login_logo_url_title' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment