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
<h1><img src="<?php echo esc_url( get_template_directory_uri() ); ?>/images/title_<?php echo esc_attr( $post->post_name ); ?>.jpg" alt="<?php the_title_attribute(); ?>" /></h1> |
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
/* | |
別途HTML側で以下のスクリプトを読み込む。 | |
<script type="text/javascript" src="https://www.google.com/jsapi"></script> | |
<script type="text/javascript" src="js/googlefeed.js"></script> | |
また、フィードを表示させたい箇所に | |
<div id="feed"><p>Now Loading...</p></div> | |
を置く。 | |
*/ |
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
※keyname の部分は作成したカスタムフィールドの名前に置き換える | |
そのまま出力 | |
<?php echo $post->keyname; ?> | |
または | |
<?php echo $post->{keyname}; ?> | |
HTMLをエスケープしたい場合 | |
<?php echo esc_html( $post->keyname ); ?> |
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 | |
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() ) { |
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
/*------------------------------------------------------------------------------ | |
WordPress required | |
-------------------------------------------------------------------------------*/ | |
/*------ entry ------*/ | |
.hentry { | |
margin-bottom: 20px; | |
overflow: hidden; | |
} |
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
@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 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 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 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 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; ?> |