<?php if(is_tax('chiiki')): //イベントレポート地域?>
<?php endif; ?>
アーカイブだったら
<?php if (is_archive()): //アーカイブだったら?> <?php endif; ?>
ディスプリクションにコンテンツの文字を指定数だけ入れる ソースを改行させない
<META name="description" content="
<?php echo mb_substr( str_replace(array("\r\n","\r","\n"),'',strip_tags($post->post_content)), 0, 120 );
//ソースを改行させない コンテンツの文字を指定数だけ入れる?>">
ディスプリクションにカスタムフィールドの文字を指定数だけ入れる ソースを改行させない
<META name="description" content="
<?php echo mb_substr( str_replace(array("\r\n","\r","\n"),'',strip_tags(get_post_meta($post->ID,"プロフィール",true))), 0, 120);
//ソースを改行させない カスタムフィールドの文字を指定数だけ入れる?>">
ディスプリクションのキーワードにタグ名とターム名を入れる
<META name="keywords" content="<?php //ターム名リンク無しで取得
$terms = wp_get_post_terms( $post->ID, 'genre' ); //分類で設定した名称
$names = array();
echo ""; //前の文字
foreach ( $terms as $term ) {
$names[] = $term->name;
}
echo implode( ',', $names ); //区切り文字を指定
?><?php
$terms = wp_get_post_terms( $post->ID, 'chiiki2' ); //分類で設定した名称
$names = array();
echo ","; //前の文字
foreach ( $terms as $term ) {
$names[] = $term->name;
}
echo implode( ',', $names ); //区切り文字を指定
?><?php //タグ名リンク無しで取得
$posttags = get_the_tags();
if ($posttags) {
foreach($posttags as $tag) {
echo $tag->name . ',';
}
}
?>">
タグ名リンク無しで取得
<?php //タグ名リンク無しで取得
$posttags = get_the_tags();
if ($posttags) {
foreach($posttags as $tag) {
echo $tag->name . ',';
}
}
?>
ターム名リンク無しで取得
<?php //ターム名リンク無しで取得
$terms = wp_get_post_terms( $post->ID, 'genre' ); //分類で設定した名称
$names = array();
echo ""; //前の文字
foreach ( $terms as $term ) {
$names[] = $term->name;
}
echo implode( ',', $names ); //区切り文字を指定
?>