tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support( 'title-tag' ); // This theme uses Featured Images (also known as post thumbnails) for per-post/per-page. add_theme_support( 'post-thumbnails' ); // Remove WordPress version from header for security concern remove_action( 'wp_head', 'wp_generator' ); // This theme uses wp_nav_menu() in header menu location. register_nav_menu( 'primary', __( 'Primary Menu', 'attitude' ) ); // Add Attitude custom image sizes add_image_size( 'featured', 670, 300, true ); add_image_size( 'featured-medium', 230, 230, true ); add_image_size( 'slider-narrow', 1038, 460, true ); // used on Featured Slider on Homepage Header for narrow layout add_image_size( 'slider-wide', 1400, 460, true ); // used on Featured Slider on Homepage Header for wide layout add_image_size( 'gallery', 474, 342, true ); // used to show gallery all images add_image_size( 'icon', 80, 80, true ); //used for icon on business layout /** * This theme supports custom background color and image */ add_theme_support( 'custom-background' ); // Adding excerpt option box for pages as well add_post_type_support( 'page', 'excerpt' ); } add_action ('save_post', 'save_events'); function save_events($post_id){ global $post; if ( !wp_verify_nonce( $_POST['events-nonce'], 'events-nonce' )) { return $post_id; } if ( !current_user_can( 'edit_post', $post->ID )) { return $post_id; } $temp_date = $_POST['event_date']; $temp_stime = $_POST['start_time']; $temp_etime = $_POST['end_time']; $event_start = date('Y-m-d H:i:s', strtotime($temp_date .' '. $temp_stime)); $event_end = date('Y-m-d H:i:s', strtotime($temp_date .' '. $temp_etime)); update_post_meta($post->ID, 'event_start', $event_start); update_post_meta($post->ID, 'event_end', $event_end); } //カテゴリIDを取得する function apt_category_id($tax='category'){ global $post; $cat_id = 0; if(is_single()){ $cat_info = get_the_terms($post->ID,$tax); if($cat_info){ $cat_id=array_shift($cat_info)->term_id; } } return $cat_id; } //カスタム投稿タイプ・カスタム分類 add_action('init','register_post_type_and_taxonomy'); function register_post_type_and_taxonomy(){ register_post_type( 'branch', array( 'labels' => array( 'name' => 'メンバー', 'add_new_item' => 'メンバーを追加', 'edit_item' => 'メンバーの編集', ), 'public' => true, 'hierarchical' => true, 'supports' => array( 'title', 'editor', 'excerpt', 'custom-fields', 'thumbnail', 'page-attributes', ), ) ); } /** * attitude_init hook * * Hooking some functions of functions.php file to this action hook. */ do_action( 'attitude_init' ); ?>