This file contains hidden or 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 if ( $post->my_description ): //meta descriptionの設定 ?> | |
| <meta name="description" content="<?php echo esc_attr( $post->my_description ); ?>" /> | |
| <?php else: ?> | |
| <meta name="description" content="<?php bloginfo('description'); ?>" /> | |
| <?php endif; ?> | |
| <?php if ( $post->my_keywords ): //meta keywordsの設定 ?> | |
| <meta name="keywords" content="<?php echo esc_attr( $post->my_keywords ); ?>" /> | |
| <?php else: ?> | |
| <meta name="keywords" content="デフォルトワード,デフォルトワード,デフォルトワード" /> |
This file contains hidden or 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 | |
| //パンくずのリッチスニペット対応 | |
| function rich_bread_crumb($output, $args) { | |
| if ($args['type'] == 'list') { | |
| $output = preg_replace('|<li\s+(.*?)>|mi','<li ${1} itemscope="itemscope" itemtype="https://data-vocabulary.org/Breadcrumb">',$output); | |
| $output = preg_replace('|<li\s+class="(.*?current.*?)".*?>|mi','<li class="${1}">',$output); | |
| $output = preg_replace('|<a\s+(.*?)>|mi','<a ${1} itemprop="url"><span itemprop="title">',$output); | |
| $output = str_replace('</a>','</span></a>',$output); | |
| } | |
| return $output; |
This file contains hidden or 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 | |
| global $post; | |
| if ( is_page() && $post->post_parent ): //子ページの場合 | |
| ?> | |
| <h1><img src="<?php echo get_template_directory_uri(); ?>/images/title_<?php echo get_page_uri($post->post_parent); ?>.jpg" alt="<?php echo esc_attr( get_the_title($post->post_parent) ); ?>" /></h1> | |
| <?php else: //親ページの場合 ?> | |
| <h1><img src="<?php echo get_template_directory_uri(); ?>/images/title_<?php echo get_page_uri($post->ID); ?>.jpg" alt="<?php the_title_attribute(); ?>" /></h1> | |
| <?php endif; ?> |
This file contains hidden or 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 if(is_category()): ?> | |
| <h1><img src="<?php echo get_template_directory_uri(); ?>/images/title_<?php | |
| $cat_id = get_query_var('cat'); | |
| $cat = get_category($cat_id); | |
| echo $cat->category_nicename; | |
| ?>.jpg" alt="<?php single_cat_title(); ?>" /></h1> | |
| <?php endif; ?> |
This file contains hidden or 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
| <h1><img src="<?php echo get_template_directory_uri(); ?>/images/title_<?php | |
| $cat = get_the_category(); | |
| $cat = $cat[0]; {echo $cat->category_nicename;} | |
| ?>.jpg" alt="<?php echo $cat->cat_name; ?>" /></h1> |
This file contains hidden or 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 | |
| //add extra fields to category edit form hook | |
| add_action ( 'edit_category_form_fields', 'extra_category_fields'); | |
| //add extra fields to category edit form callback function | |
| function extra_category_fields( $tag ) { //check for existing featured ID | |
| $t_id = $tag->term_id; | |
| $cat_meta = get_option( "category_$t_id"); | |
| ?> | |
| <tr class="form-field"> | |
| <th scope="row" valign="top"><label for="extra1">meta robots指定</label></th> |
This file contains hidden or 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 | |
| //管理者以外はログイン成功後ダッシュボードではなくトップページへ飛ばす | |
| function redirect_login_front_page() { | |
| if( !current_user_can('administrator') ){ | |
| $home_url = site_url('', 'http'); | |
| wp_safe_redirect($home_url); | |
| exit(); | |
| } | |
| } |
This file contains hidden or 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
| @charset "utf-8"; | |
| /*------------------------------------------------------------------------------ | |
| reset.css 2014.03.18 | |
| -------------------------------------------------------------------------------*/ | |
| html { overflow-y: scroll; } | |
| article, aside, canvas, details, figcaption, figure, header, footer, hgroup, menu, nav, section, summary { display: block; } | |
| body, div, dl, dt, dd, ul, ol, li, pre, code, form, fieldset, legend, input, textarea, p, blockquote, th, td { margin: 0; padding: 0; } | |
| address, caption, cite, code, dfn, em, strong, th, var { font-style: normal; } | |
| img, abbr, acronym, fieldset, a img { border: none; } |
This file contains hidden or 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
| /*------------------------------------------------------------------------------ | |
| WordPress required | |
| -------------------------------------------------------------------------------*/ | |
| /*------ entry ------*/ | |
| .hentry { | |
| margin-bottom: 20px; | |
| overflow: hidden; | |
| } |
This file contains hidden or 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 | |
| function customed_queries ( $query ) { | |
| if ( is_feed() ) { // フィードにカスタム投稿を含める | |
| $query->set( 'post_type', array( 'post', 'gallery' ) ); | |
| return $query; | |
| } | |
| if ( is_admin() || ! $query->is_main_query() ) { //管理画面とサブクエリは対象外 | |
| return; | |
| } | |
| if ( $query->is_main_query() ) { |