Skip to content

Instantly share code, notes, and snippets.

@tkc49
Last active December 15, 2015 08:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tkc49/5229399 to your computer and use it in GitHub Desktop.
Save tkc49/5229399 to your computer and use it in GitHub Desktop.
[WordPress] Change edior-style. front-page,page /editor-styleのcssをフロントページと各固定ページごとに切り替える
if(is_admin() && isset( $_GET['post'] )){
if($_GET['post']==get_option( 'page_on_front' )){
if ( locate_template( array( 'editor-style-front.css' ) ) ) {
add_editor_style('editor-style-front.css');
}else{
add_editor_style();
}
}else{
if ( locate_template( array( sprintf('editor-style-%s.css' , get_page($_GET['post'])->post_name ) ) ) ) {
add_editor_style(sprintf('editor-style-%s.css' , get_page($_GET['post'])->post_name ));
}else{
add_editor_style();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment