Skip to content

Instantly share code, notes, and snippets.

@wadadanet
Last active September 24, 2019 05:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wadadanet/70edde30dabb09fb17f6fadbf8b63da3 to your computer and use it in GitHub Desktop.
Save wadadanet/70edde30dabb09fb17f6fadbf8b63da3 to your computer and use it in GitHub Desktop.
function console( $data, $log = false ) {
if(WP_DEBUG){
$_data = json_encode($data);
$obj = debug_backtrace();
$parent = $obj[0];
$path = $parent['file'];
$filename = basename($path);
if($log){
error_log("\n".gettype($data)."--", 3, dirname( __FILE__ ) . '/../../app.log');
error_log("\n".$_data, 3, dirname( __FILE__ ) . '/../../app.log');
}
else {
echo "<script>console.log('-- $filename')</script>";
echo "<script>console.dir($_data)</script>";
}
}
}
function echo_filename(){
if(WP_DEBUG){
$obj = debug_backtrace();
$parent = $obj[0];
$path = $parent['file'];
$filename = basename($path);
echo "<!-- $filename -->";
}
}
function tdir(){
return get_template_directory_uri();
}
function remove_menus(){
// remove_menu_page( 'index.php' ); //ダッシュボード
remove_menu_page( 'edit.php' ); //投稿メニュー
// remove_menu_page( 'upload.php' ); //メディア
// remove_menu_page( 'edit.php?post_type=page' ); //ページ追加
remove_menu_page( 'edit-comments.php' ); //コメントメニュー
// remove_menu_page( 'themes.php' ); //外観メニュー
// remove_menu_page( 'plugins.php' ); //プラグインメニュー
// remove_menu_page( 'tools.php' ); //ツールメニュー
// remove_menu_page( 'options-general.php' ); //設定メニュー
}
add_action( 'admin_menu', 'remove_menus' );
// Gutenberg
add_editor_style( 'editor-style.css' );
add_theme_support( 'editor-styles' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment