Skip to content

Instantly share code, notes, and snippets.

@hissy
Created July 21, 2013 04:05
Show Gist options
  • Save hissy/6047442 to your computer and use it in GitHub Desktop.
Save hissy/6047442 to your computer and use it in GitHub Desktop.
#WbOsaka plugin sample
/**
* 背景の変更
*/
body.login {
background: url(background.jpg) repeat 0 0;
}
/**
* WordPressロゴを変更
*/
.login h1 a {
background-image: url(logo.jpg);
}
<?php
/*
Plugin Name: Login Customize
*/
// ログイン画面でCSSを読み込み
function login_background_image() {
echo '<link rel="stylesheet" type="text/css" href="' . plugins_url( 'login-customize.css' , __FILE__ ) .'" />';
}
add_action('login_head', 'login_background_image');
// ログインフォームの下にコンテンツを追加
function add_footer_contents(){
echo 'ほげほげ';
}
add_action('login_footer', 'add_footer_contents');
// ロゴのリンク先を変更
function change_login_headerurl($login_header_url) {
$login_header_url = 'http://google.co.jp/';
return $login_header_url;
}
add_filter('login_headerurl', 'change_login_headerurl');
// ロゴのtitle属性を変更
function change_login_headertitle($login_headertitle) {
$login_headertitle = 'Powered by 俺';
return $login_headertitle;
}
add_filter('login_headertitle', 'change_login_headertitle');
// ログイン画面でjQueryを追加
function add_jquery_to_login(){
wp_enqueue_script('jquery');
}
add_action('login_enqueue_scripts','add_jquery_to_login');
// ログインフォームをdivで囲む
function add_script_to_login(){
echo '<script>jQuery("#loginform").wrap("<div class=\'hoge\'></div>");</script>';
}
add_action('login_footer','add_script_to_login');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment