Last active
December 15, 2015 16:29
-
-
Save hissy/5289647 to your computer and use it in GitHub Desktop.
#WordPress Twenty Twelve のタイトルフィルタリングを子テーマから変更、あるいはキャンセルする
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 | |
/* | |
* Twenty Twelve の wp_title のフィルタリングを改変する | |
* Ref: http://wordpress.org/support/topic/overriding-twentytwelve_wp_title-in-a-child-theme | |
*/ | |
function my_wp_title( $title, $sep ) { | |
global $paged, $page; | |
// 好きな処理 | |
return $title; | |
} | |
function adjust_twentytwelvechild_wp_title() { | |
add_filter( 'wp_title', 'my_wp_title', 10, 2 ); | |
remove_filter( 'wp_title', 'twentytwelve_wp_title', 10, 2 ); | |
} | |
add_action('after_setup_theme','adjust_twentytwelvechild_wp_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
<?php | |
/* | |
* Twenty Twelve の wp_title のフィルタリングを単に削除する | |
*/ | |
function adjust_twentytwelvechild_wp_title() { | |
remove_filter( 'wp_title', 'twentytwelve_wp_title', 10, 2 ); | |
} | |
add_action('after_setup_theme','adjust_twentytwelvechild_wp_title'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment