d-making の 広告カテゴリ一覧 に新着NEWを 1ヶ月以内に 投稿された記事があれば

ポイントというか
ハマった点は
get post の
cat =>
ではタームID?
ゲットがテゴリーでとった id では
だめだめで

けっか
タックスクエリーをしなきゃいかんかった

<div class="disign_cate_box_all">

<?php
$cat_tax= 'd_cate_jirei';
$filed ='d_jirei_cat_img';
$args = array(
	'type'                     => 'post',
	'child_of'                 => 0,
	'parent'                   => 0,//0で親かてのみ ''で子もでる
	'orderby'                  => 'name',
	'order'                    => 'ASC',
	'hide_empty'               => 0,
	'hierarchical'             => 1,
	'exclude'                  => '',
	'include'                  => '',
	'number'                   => '',
	'taxonomy'                 => $cat_tax,
	'pad_counts'               => false ,
	'exclude' 				   => '321,322'
); 
$categories = get_categories($args);
//$categories = get_categories('parent=0'); 親カテゴリーのみ
foreach($categories as $category) :
 
$cat_id = $category->cat_ID;
$post_id = $cat_tax.'_'.$cat_id; 
   
$catimg = get_field($filed,$post_id);
$img = wp_get_attachment_image_src($catimg,W214_142);

$disp = get_field('d_jirei_cat_disp',$post_id);
$catekakaku1 = get_field('catekakaku1',$post_id);
$catekakaku2 = get_field('catekakaku2',$post_id);
$catekakaku3 = get_field('catekakaku3',$post_id);



?>



<div class="disign_cate_box">

<h3 class="disign_cate_box_title"><i class="icon-quote-left"></i><?php echo $category->cat_name; ?></h3>

			

 <div style="position:relative; margin-bottom:20px;">

<div class="disign_cate_box_img_box">
<div class="dcent">
<?php
// 1ヶ月以内に投稿された記事を取得して、あればNEWを出力する
$three_month_ago = date('Y-m-d 0:0:0', strtotime('-1 month'));//何ヶ月か?
$cat_current   = $category->slug; //現在のカテゴリID
$mydata = get_posts(
array(	'post_type' => 'd_jirei', 
    	'date_query' => array(
        	array(
        	'after'     => $three_month_ago,  //何ヶ月か
       		'inclusive' => true
       				), 
    							),
			'tax_query' => array(
			'relation' => 'AND',
			array(
				'taxonomy' => $cat_tax,
				'field' => 'slug',
				'terms' => $cat_current,
//'operator'=>'NOT IN'
				),
),
	)
);
?>
<?php  
if( !empty( $mydata ) ) {
	echo '<div class="new_icon"><img src="/img/new_icon/rainbow1.gif" width="31" height="12" alt="愛知県春日井市ホームページ制作NEW記事"></div>';
?>
	
<?php
}
wp_reset_postdata();
?>		
<a href="/デザイン事例カテゴリ/<?php echo $category->category_nicename; ?>" style="background-color:#FFF">
<img src="<?php if($img):
echo $img[0]; 
else:
echo '/img/no_photo_214_142.jpg';
endif;
 ?>" alt="<?php echo $category->cat_name; ?>" /></a></div></div>

<?php
 echo $disp
 ?>
<div style="clear:both;"></div>
<a href="/デザイン事例カテゴリ/<?php echo $category->category_nicename; ?>" class="d_cate_tuduki mailform_bottan">制作実績をみる</a>
</div>

<?php if($catekakaku1):?>
<table><caption>料金の目安</caption><tr><td><?php echo $catekakaku1; ?></td><td><?php echo $catekakaku2; ?></td></tr></table>
<?php endif; ?>
<div style="font-size:80%; padding:12px;">
<?php echo$catekakaku3; ?>
</div>
</div>


<?php endforeach; ?>
<div style="clear:both;"></div>





</div>




</div class="jirei_box_all">

http://notebook.yamamotohiroyuki.com/wordpress/2012/08/15/%E3%81%A1%E3%82%87%E3%81%84%E3%81%A1%E3%82%87%E3%81%84%E5%BF%98%E3%82%8C%E3%82%8B%E3%80%8Ewp_query%E3%80%8F%E3%81%AE%E4%BD%BF%E3%81%84%E6%96%B9/

<?php
$args = array(
  'cat' => 1,
  'posts_per_page' => 5
);
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) :
  while ( $the_query->have_posts() ) : $the_query->the_post();
endwhile;
  //ここにループするテンプレート
endif;
wp_reset_postdata();
?>

http://www.tam-tam.co.jp/tipsnote/cms/post6697.html

<?php
// 2015年9月10日から、2015年10月10日までに投稿された記事を取得して、タイトルを出力する
$mydata = get_posts( array(
	'posts_per_page' => -1,
	'date_query' => array(
		array(
			'after' => array(
				'year' => 2015,
				'month' => 9,
				'day' => 10,
			),
			'before' => array(
				'year' => 2015,
				'month' => 10,
				'day' => 10,
			),
			'inclusive' => true,
		),
	),
) );
if( !empty( $mydata ) ) {
	foreach( $mydata as $post ) {
		setup_postdata( $post );
?>
<h1><?php the_title(); ?></h1>
<?php
	}
}
?>

このへんとかは カテゴリ で ポストだったでよかったんだな

何ヶ月いないは
これ参考
http://bugpixel.net/output/web/date_query-wordpress/

<?php
$cats = get_the_category();
$cat = $cats[0];
$cat_current   = $cat->cat_ID; //現在のカテゴリID
?>
<?php
$three_month_ago = date('Y-m-d 0:0:0', strtotime('-3 month'));
$mydata = get_posts(array(
	'category'     => $cat_current,
    'date_query' => array(
        array(
        	'after'     => $three_month_ago,  //3ヶ月
        	'inclusive' => true
        ), 
    )
));
?>
<ul class="link">
<?php  
if( !empty( $mydata ) ) {
	foreach( $mydata as $post ) {
		setup_postdata( $post );
?>
	<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php
	}
}
wp_reset_postdata();
?>       
</ul>    

レスポンシブル参考

画像 基本 画像の横幅をウインドウ幅に合わせたいが、原寸より大きくはしたくない場合
http://tips.nishishi.com/css/image-max-width.html

img {
   width: 100%; /* 横幅に合わせて自動で拡大縮小する */
}


img {
   max-width: 100%; /* 横幅に合わせて自動縮小するが、拡大はしない */
}

アスペクト比を固定したボックス要素
http://www.panarea-is.com/%E3%83%AC%E3%82%B9%E3%83%9D%E3%83%B3%E3%82%B7%E3%83%96%E3%83%87%E3%82%B6%E3%82%A4%E3%83%B3%E3%81%A7%E3%82%82%E4%BD%BF%E3%81%88%E3%82%8B%E3%82%A2%E3%82%B9%E3%83%9A%E3%82%AF%E3%83%88%E6%AF%94%E3%82%92/

.aspectwrapper {
position: relative;
width:50%;
background:#000000;
}
.aspectwrapper:after{
padding-top: 100%;
display: block;
content: “”;
}
.aspectwrapper > .content{
position: absolute;
top: 0px;
left: 0px;
bottom: 0px;
right: 0px;
}

スマホ対応するならCSSでword-wrap:break-wordを指定しよう

http://kudox.jp/html-css/word-wrap_break-word

{
  word-wrap:break-word;
}

したくない要素

{
  overflow:scroll;
  word-wrap:normal;
}

テーブル

table {
  table-layout:fixed;
}
うえのほうがいい感じ
table {
  word-break:break-all;
}
これだめ

記事ループで 何個目に 広告を入れる

<?php if (have_posts()) :$ransuu = rand(1, 5);
while (have_posts()) : the_post(); $loop_count++; ?>



<?php if ( $loop_count == $ransuu ) : ?>
 
<?php if(is_mobile()) { ?>
 
// ※ここにスマホ表示用のGoogle AdSense等の広告コードを入力
// ただしスマホ用なので横幅(width)は300px以下にすること
 
<?php } else { ?>
 
// ※ここにpc表示用のGoogle AdSense等の広告コードを入力
// pc用は横幅(width)は500px,高さ(height)は100px程度がおすすめ
 
<?php } ?>
<?php endif; ?>




<?php endwhile; else: ?>
  <p>記事がありません</p>
  <?php endif; ?>

レスポンシブ ギャラリー 強引なまとめ

<script type="text/javascript" src="/js/jquery.imageNavigation.js"></script>
<script type="text/javascript">
      $(function(){
        $("#img_box,#img_box2").imageNavigation({
          time:2000,
          animationTime:500,
          rolloverTime: 0,
          rolloutTime: 500,
		  autoPlay: false,
        });
      });
</script>


<script type="text/javascript">
$(window).on('load resize', function(){
var $w = ($('#img_box2 img.d-garabox').height());
$('.navi-image .d_respo_hight img').css("max-height", $w);
$('#img_box2 .navi-image a').css("max-height", $w);
//$('.viewer').height(w);
});
</script>
/*---------------------------------ギャラリー-------------------------------------------------*/
#img_box2 {
	width: 640px;
/*	margin-top: 20px;*/
	margin-right: auto;
	margin-bottom: 20px;
	margin-left: auto;
	overflow: hidden;
}
#img_box2 .navi-image {
	position: relative;
	height: 480px;
	width: 640px;
	overflow: hidden;
}
#img_box2 .navi-image a {
	position: absolute;
	left: 0px;
	top: 0px;
	background-color: #FFF;
	height: 480px;
	width: 640px;
	text-align: center;
	overflow: hidden;
	
	
	/*
	position: absolute;
	left: 0px;
	top: 0px;
	background-color: #FFF;
	height: 478px;
	width: 638px;
	text-align: center;
	overflow: hidden;
	border: 1px solid #FFF;*/
}
#img_box2 .navi-image a.last-active {
	z-index: 9;
}

#img_box2 .navi {
	overflow: hidden;
	padding-left:1%;
	padding-right:1%;
	-moz-box-sizing: border-box;
box-sizing: border-box;
margin-top:10px;
}



#img_box2 .navi-image a.active {
	z-index: 10;
}
#img_box2 .navi ul{
	margin: 0px;
	padding: 0px;
/*	width: 650px;*/
}
#img_box2 .navi ul li {
	float: left;
	list-style-type: none;
	padding: 0px;
	overflow: hidden;
	/*height:52px;*/
	width: 19%;
	position: relative;
	margin-top: 0px;
	margin-right: 2px;
	margin-bottom: 2px;
	-moz-box-sizing: border-box;
	box-sizing: border-box;
	
}

#img_box2 .navi ul li:after{
padding-top: 61.8%;
display: block;
content: "";
}
#img_box2 .navi ul li .img_navi{
position: absolute;
top: 0px;
left: 0px;
bottom: 0px;
right: 0px;
}


#img_box2 .navi ul li img{ width:100%; height:auto}
#img_box2 .navi-image a img{position: absolute;
    top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;}

#img_box2 .navi ul li a {
	margin: 0px;
	padding: 0px;
	display: block;
}


#img_box2, #img_box2 .navi-image, #img_box2 .navi-image a, #img_box2 .navi {
    width: 100%;
}

.d-garabox{ width: 100%;height: auto; }

#img_box2 .navi-image a img{ width:auto; max-width:100%; height:auto;}

/*ギャラリーメニュー アクティブとホバーくっきり*/	
#img_box2 .navi img {
  opacity: 0.4;
  filter: alpha(opacity=40);
  -ms-filter: "alpha(opacity=40)";
  -moz-opacity: 0.4;
  -khtml-opacity: 0.4;
  zoom: 1;
}

.navi .active > img
{
	opacity: 1!important;
	filter: alpha(opacity=100)!important;
	-ms-filter: "alpha(opacity=100)"!important;
	-moz-opacity: 1!important;
	-khtml-opacity: 1!important;
	zoom: 1!important;
	
	}


/*ディバイススマフォ*/
@media screen and (max-width: 490px){

/*--------------------------------------カーシングルスマフォ*/
#img_box2{ width:100%; height:auto;}

#img_box2 .navi-image{ width:100%; height:auto;/*max-height:300px; min-height:200px;*/}

#img_box2 .navi-image a{ width:100%; /*height:auto;*/}

#img_box2 .navi-image a img{ width:auto; height:auto;}

#img_box2 .navi{ width:100%; height:auto;}

#img_box2 .navi ul{ width:100%; height:auto;}





#img_box2 .navi ul li	{ width:24%}
/*初期のスマホギャラリーの高さ*/
.navi-image .d_respo_hight img,
#img_box2 .navi-image a{ max-height:251px;}


	
}
<div id="img_box2">
  

  <div class="navi-image">



 
   <?php
$fields = $cfs->get('shop_gallery');
foreach ($fields as $field) :
?>
<?php
$title= get_the_title();
 $attachment_id = $field['gallery_photo'];
?>


<a href="#" onClick="return false;" class="d_respo_hight">
<?php 
$car_photo = wp_get_attachment_image($attachment_id,'640_480',0,array('alt'=>$title,'title'=>$title));
echo $car_photo;
?>
</a>
<?php
endforeach;
?>
 
  <?php $hoge = get_field('car_label'); 
if($hoge == '店長おすすめ'): ?>
<div class="rabel_rabel">
<img src="/img/rable1_page.png" width="193" height="28" alt="店長おすすめ中古車">
</div>

<?php elseif($hoge == 'その他'): ?>


<?php endif; ?>


<?php //new
$days=30;
$today=date('U'); $entry=get_the_time('U');
$diff1=date('U',($today - $entry))/86400;
if ($days > $diff1) {
echo '
    <div class="rabel_new">
    <img src="/img/rable_new.png" width="54" height="54" alt="新着中古車">
    </div>
	';
}
?>

  <?php //公開状態
   $hoge = get_field('car_open'); 
if($hoge == '10'): 
 //商談中
?>   
    <div class="rabel_status">
    <img src="/img/rabel_shoudan_page.png" width="198" height="41" alt="この中古車は商談中です。">
    </div>
 <?php elseif($hoge == '1'): 
  //売り切れ?>   
    <div class="rabel_status">
    <img src="/img/rabel_sold_out_page.png" width="640" height="480" alt="この中古車は完売しました。" class="d-garabox">
    </div>
<?php endif; ?> 

<img src="/img/d-garabox_back.png" class="d-garabox">



  </div>
  
  <div class="navi">
<ul>


   <?php
$fields = $cfs->get('shop_gallery');
foreach ($fields as $field) :
?>
<?php
$title= get_the_title();
 $attachment_id = $field['gallery_photo'];
?>


<li><p class="img_navi"><a href="#" onClick="return false;">
<?php 
$car_photo = wp_get_attachment_image($attachment_id,'140_93',0,array('alt'=>$title,'title'=>$title));
echo $car_photo;
?>
</a></p></li>
<?php
endforeach;
?>


    </ul>
  </div>
  <div style="clear:both;"></div>
  
  


  </div id="img_box2">

クリッカブルのレスポンシブ

<!--レスポンクリッカブル--->
<script type="text/javascript" src="/js/jquery.rwdImageMaps.min.js"></script>

<script type="text/javascript">
$(document).ready(function(e) {
	$('img[usemap]').rwdImageMaps();
});
</script>
.d_mapbox2{margin-bottom:30px; width:100%;position:relative; display:none}

.d_mapbox2 img[usemap] {
		border: none;
		height: auto;
		max-width: 100%;
		width: auto;
	}

ブート

@media (max-width: 768px) {
.d_mapbox{ display:none}
.d_mapbox2{ display: block}
}
<div class="d_mapbox2" > <img src="/img/test.png" usemap="#resp" id="#resp" width="730" height="385" alt="春日井mapメニュー"/>
            <map name="resp">
              <area shape="rect" coords="486, 195, 562, 250" href="/お店/地区/岩成台/" />
              <area shape="rect" coords="486, 139, 562, 194" href="/お店/地区/藤山台/"/>
              <area shape="rect" coords="620, 79, 703, 327" href="/お店/地区/石尾台/"/>
              <area shape="poly" coords="619, 310, 450, 311, 450, 181, 486, 181, 486, 250, 562, 250, 562, 233, 620, 233" href="/お店/地区/高蔵寺/"/>
              <area shape="poly" coords="618, 231, 621, 75, 545, 75, 545, 139, 564, 139, 564, 235, 618, 235, 615, 234" href="/お店/地区/高森台/" />
              <area shape="poly" coords="450, 7, 450, 182, 486, 182, 486, 139, 546, 139, 546, 75, 622, 75, 622, 5" href="/お店/地区/坂下/" />
              <area shape="poly" coords="450, 317, 314, 317, 314, 293, 342, 293, 342, 168, 450, 168"href="/お店/地区/南城/"/>
              <area shape="poly" coords="260, 79, 450, 78, 450, 169, 342, 169, 342, 183, 260, 183" href="/お店/地区/松原/" />
              <area shape="rect" coords="260, 182, 342, 299"  href="/お店/地区/東部/"  />
              <area shape="rect" coords="176, 9, 260, 167"  href="/お店/地区/鷹来/"  />
              <area shape="rect" coords="176, 167, 260, 295"  href="/お店/地区/柏原/"  />
              <area shape="rect" coords="24, 204, 77, 312"  href="/お店/地区/味美/"  />
              <area shape="rect" coords="74, 42, 176, 205"  href="/お店/地区/西部/" />
              <area shape="rect" coords="77, 204, 133, 353" href="/お店/地区/知多/"  />
              <area shape="poly" coords="133, 204, 133, 353, 317, 353, 317, 294, 176, 295, 176, 204" href="/お店/地区/中部/"/>
            </map>
            <!--城北線-->
            <a class="eki jyouhoku map_jyouhoku_ajiyoshi" href="/お店/最寄り駅/味美駅/城北線/#"> 味美駅</a> <a class="eki jyouhoku map_jyouhoku_kachigawa" href="/お店/最寄り駅/勝川駅/城北線/"> 勝川駅</a>
            <!--名鉄-->
            <a class="eki meitetsu map_meitetsu_ajima" href="/お店/最寄り駅/味鋺駅/名鉄/"> 味鋺駅</a> <a class="eki meitetsu map_meitetsu_ajiyoshi" href="/お店/最寄り駅/味美駅/名鉄/"> 味美駅</a> <a class="eki meitetsu map_meitetsu_kasugai" href="/お店/最寄り駅/春日井駅/名鉄/"> 春日井駅</a> <a class="eki meitetsu map_meitetsu_ushiyama" href="/お店/最寄り駅/牛山駅/名鉄/"> 牛山駅</a>
            <!--JR-->
            <a class="eki jr map_jr_kachigawa" href="/お店/最寄り駅/勝川駅/jr/"> JR 勝川駅</a> <a class="eki jr map_jr_kasugai" href="/お店/最寄り駅/春日井駅/jr/"> JR 春日井駅</a> <a class="eki jr map_jr_jinryo" href="/お店/最寄り駅/神領駅/jr/"> JR 神領駅</a> <a class="eki jr map_jr_kouzouji" href="/お店/最寄り駅/高蔵寺駅/jr/"> JR 高蔵寺駅</a> <a class="eki jr map_jr_jyoukouji" href="/お店/最寄り駅/定光寺駅/jr/"> JR 定光寺駅</a>
            <!--春日井市以外-->
            <a class="map_komaki" href="/お店/地区/小牧市/"> 小牧市</a> <a class="map_inuyama" href="/お店/地区/犬山市/"> 犬山市</a>
            <div class="eki_setumei">
              <div class="setumei se1">JR中央本線</div>
              <div class="setumei se2">名鉄小牧線</div>
              <div class="setumei se3">東海交通事業 城北線</div>
            </div>
            <div class="chiiki_setumei"> (中学校区別) </div>
          </div>

結果 ちいさすぎてつかわん

wordpress 予約フォーム ken設計 チュートリアル

参考
http://design-plus1.com/tcd-w/2014/12/mts-simple-bookin-c-ver-1-2-1.html

DL
http://mtssb.mt-systems.jp/downloadp/

オフィシャルガイド
http://mtssb.mt-systems.jp/documentation/
ドロップダウンメニューにすべてある

予約カレンダー

[monthly_calendar id="ページID"]

予約フォームのスラッグに
booking-form

予約完了ページに
booking-thanks
とメッセージ
ご予約ありがとうございます。
キャンセルのご連絡は1日前までにお願いします。

など

あと
子ども 乳児などを表示したい場合
各種設定 予約カウント でチェック

予約受付開始をいれることで 今からその時間をプラスした時間は予約出来なくなる

対応できなそうなのは
土日と平日の受付時間を変える

課題は
複数案件に対応しているか
管理権限を投稿者でもできるか

予約メールフォーム後、完了メールを送信しますとなっている。

重複防止 記事タイトルが同じだったら タイトルとディスプリクションが被る件

だいぶスキル上がったなjsの本よんだでかな
正規表現も学ぼう

分岐準備メタタグ前に

<?php
//シングルでタイトルが同じ記事が合った場合-2とかスラッグにつくが、the_title wp_titleにはつかないのでディスプリクション・タイトルが重複するのを防ぐ
if (is_single()){//シングルなら
$dd_title = urldecode ($slug_name = $post->post_name);// スラッグを取得
//echo $dd_title;
$keywords = preg_split("/[-]+/", $dd_title);//phpスプリット - にて
//print_r($keywords);
$last = end($keywords); //配列の最後を取得する ほにゃらら-2 $keywords[0]がほにゃらら $keywords[1]が2
//echo $last;
if (ctype_digit($last)) {//ケツが数字なら
//echo $last;
}
}
?>

ディスプリクションでは

<?php elseif(is_single()): ?><?php the_title(); ?><?php if (ctype_digit($last)) ://ケツが数字なら つまりタイトルが重複 ?><?php echo $last; endif ?> | 

タイトルでは

global $page, $paged;

	if (is_single())://シングルなら
//分岐準備はメタディスプの前に書いてある
if (ctype_digit($last)) ://ケツが数字なら つまりタイトルが重複	
wp_title( ''.$last.' | ', true, 'right' ); //数字を差し込む
else://普通
wp_title( ' | ', true, 'right' );	
endif;
	else:

	wp_title( '|', true, 'right' );
	
	endif;

重複防止 カテゴリのスラッグの方をディスプリクション/タイトルに入れる場合 デコードして 

ビシューで ブログ納入実績カテゴリ と 納入実績のタイトルとディスプリクションがかぶった

解りやすく カテゴリを納入実績としてスラッグをブログ納入実績
としたため

対策 

ディスプリクション&タイトルで入れる文字をスラッグにする

if(is_category()): echo urldecode ($tax_slug = get_term_by( 'name', single_term_title( '', false ), 'category' )->slug)


global $page, $paged;
	
	
	if (is_category()): 
	echo urldecode ($tax_slug = get_term_by( 'name', single_term_title( '', false ), 'category' )->slug);
	echo ' | ';
	
	else:

	wp_title( '|', true, 'right' );
	
	endif;

デコードしないと文字化けする

http://php.net/manual/ja/function.urldecode.php

タクソノミーでも行ける
http://elearn.jp/wpman/function/get_term_by.html

WordPress, シングルでもwp_list_categoriesにcurrent-cat

参考https://www.evernote.com/pub/0xmxkx/mynotebook#st=p&n=c1dcd2ca-de1c-46d6-a3fd-2171181c40dc

//カテゴリ シングルでもwp_list_categories にカレント 
function sgr_show_current_cat_on_single($output) {
     global $post;
     if( is_single()) {
          $categories = wp_get_post_categories($post->ID);
          foreach( $categories as $catid ) {
	  $cat = get_category($catid);

	       // Find cat-item-ID in the string
	       if(preg_match('#cat-item-' . $cat->cat_ID . '#', $output)) {
	            $output = str_replace('cat-item-'.$cat->cat_ID, 'cat-item-'.$cat->cat_ID . ' current-cat', $output);
	       }
          }

     }
     return $output;
}
add_filter('wp_list_categories', 'sgr_show_current_cat_on_single');
 カスタム
//タクソノミーd_cate_jirei ポストタイプd_jirei シングルでもwp_list_categories にカレント 
function d_show_current_tram_on_single($output) {
     global $post;
     if( is_singular( 'd_jirei' )) {
          $tarms =wp_get_post_terms($post->ID, 'd_cate_jirei');
          foreach( $tarms as $tarm ) {
			  
	$tarmid = $tarm->term_id;
			  
$dtarm = get_term($tarmid, 'd_cate_jirei');
	       // Find cat-item-ID in the string
	       if(preg_match('#cat-item-' . $dtarm->term_id . '#', $output)) {
	            $output = str_replace('cat-item-'.$dtarm->term_id, 'cat-item-'.$dtarm->term_id . ' current-cat', $output);
	       }
          }

     }
     return $output;
}

add_filter('wp_list_categories', 'd_show_current_tram_on_single');

get_postでの書き方 ループ

 
          <?php
	$args = array(
		'posts_per_page' => 3,
		'cat' => 337,
);

	$myposts = get_posts( $args );
	if(! $myposts){ echo '<div style="margin-left:20px;">記事はまだありません。</div>';}
	foreach ( $myposts as $post ) : setup_postdata( $post ); ?>
内容

  <?php endforeach; 
wp_reset_postdata();?>

なんだかページ送りが上手く簡単にいかなかったので
クエリポストで ページ送りある場合は

カスタムフィールドに日付を入れて その日より5年以内なら表示するっていうループの宣言

つまり開業日が5年以内のショップは表示されるってこと
若い店から表示

<!----宣言----->
          <?php
		   $d_today = date("Ymd");//今日を取得して
		  $d_5years = $d_today - 50000;//5年と00ヶ月00日を引くと5年前の日付を取得できる。
		
	$args = array(
		'posts_per_page' => 3,
		'post_type' => 'shop', //カスタム投稿名
		'meta_key'=>'open_day',
		'orderby' => 'meta_value_num',
		'order' => 'DESC',
		
		'meta_query' => array(//カスタムフィールドによる絞り込み
            array(
                'key' => 'open_day',//カスタムフィールド オープン日
               'value' => '',//空のやつは
		'compare'=>'NOT IN'//含めん
            ),
			 array(
                'key' => 'open_day',//カスタムフィールド名 オープン日
               'value' > $d_5years, //5年以内のやつを 含める (数値大きいと5年以内)
            ),
        ),
		
	);
?>

アドバンスで日付作った。

meta_query
http://elearn.jp/wpman/column/c20110915_01.html

php日付
http://php.net/manual/ja/function.date.php

他ユーザーの記事を除外

//他ユーザーの投稿を編集する権限がない場合に、一覧表示から他ユーザーの記事を除外
function exclude_other_posts( $wp_query ) {
    if ( isset( $_REQUEST['post'] ) && post_type_exists( $_REQUEST['post'] ) ) {
        $post_type = get_post_type_object( $_REQUEST['post'] );
        $cap_type = $post_type->cap->edit_other_posts;
    } else {
        $cap_type = 'edit_others_posts';
    }
 
    if ( is_admin() && $wp_query->is_main_query() && ! $wp_query->get( 'author' ) && ! current_user_can( $cap_type ) ) {
        $user = wp_get_current_user();
        $wp_query->set( 'author', $user->ID );
    }
}
add_action( 'pre_get_posts', 'exclude_other_posts' );
function exclude_other_posts( $wp_query ) {
    if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) ) {
        $post_type = get_post_type_object( $_REQUEST['post_type'] );
        $cap_type = $post_type->cap->edit_other_posts;
    } else {
        $cap_type = 'edit_others_posts';
    }
 
    if ( is_admin() && $wp_query->is_main_query() && ! $wp_query->get( 'author' ) && ! current_user_can( $cap_type ) ) {
        $user = wp_get_current_user();
        $wp_query->set( 'author', $user->ID );
    }
}
add_action( 'pre_get_posts', 'exclude_other_posts' );
所有 (1) | すべて (7) | 公開済み (4) | 下書き (3)

の数字が合わなくなってしまうのが気になる方は、CSSで .count に display: none; があたるようにしてください。

/*ブログ投稿一覧カラムの上の部分*/
.post-type-post .subsubsub .count,.post-type-post .subsubsub .all,

http://www.warna.info/archives/2557/

wordpress 記事制限 時間 まとめ

結局 下書きは書けるけど
公開はできないという制限はうまくいかなかった

12時間に1記事と制限はできたが
下書きは書けない

デフォルトユーザーには効かない という
プラグイン
Post Creation Limits(Bainternet Posts Creation Limits)

はじめはLimit Postsを入れたが
下書きを書き溜めたらいくつでも公開できた
https://wordpress.org/support/plugin/limit-posts
今後できるようにするらしいからチェックしよう

Post Creation Limits(Bainternet Posts Creation Limits)
もanyにしなければ同じ事ができた。

/カスタムフィールドからgooglemapの経度緯度を取得し 入れるコード

//カスタムフィールドからgooglemapの経度緯度を取得し 入れるコード
function replace_post_address($id) {
    $post = get_post($id);
    // post_typeを判定(post, page, カスタム投稿)
    if( $post->post_type == 'shop' ){
	    $custom_fields = get_post_custom($id);
	    $custom_field_address = $custom_fields['所在地'];
	    $googleMapsApiData = json_decode(@file_get_contents('http://maps.google.com/maps/api/geocode/json?sensor=false&address='.urlencode($custom_field_address[0])),ture);
		//緯度経度を取得
$lat = $googleMapsApiData['results'][0]['geometry']['location']['lat'];//コレが緯度
$lng = $googleMapsApiData['results'][0]['geometry']['location']['lng'];//コレが経度

		// カスタムフィールド(_lat)がセットされているか
    	if (isset($custom_fields['_lat'][0])) {
			update_post_meta($id, '_lat', $lat);
    	} else {
    		add_post_meta($id, '_lat', $lat);
    	}

    	if (isset($custom_fields['_lng'][0])) {
			update_post_meta($id, '_lng', $lng);
    	} else {
    		add_post_meta($id, '_lng', $lng);
    	}
    }
}
add_action( 'wp_insert_post', 'replace_post_address' );

参考

http://com4tis.net/wordpress-customfield-use-customfield-register/
http://www.sandalot.com/wordpress%E3%81%A7%E6%96%B0%E8%A6%8F%E6%8A%95%E7%A8%BF%E6%99%82%E3%80%81%E5%88%A5%E3%81%AA%E6%8A%95%E7%A8%BF%E3%82%82%E8%BF%BD%E5%8A%A0%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/
http://smkn.xsrv.jp/blog/2012/12/post-number-to-latlng-with-google-maps-ap/
https://wpdocs.osdn.jp/%E9%96%A2%E6%95%B0%E3%83%AA%E3%83%95%E3%82%A1%E3%83%AC%E3%83%B3%E3%82%B9/update_post_meta

http://easyramble.com/wordpress-meta-keywords-with-custom-field.html

https://wpdocs.osdn.jp/%E9%96%A2%E6%95%B0%E3%83%AA%E3%83%95%E3%82%A1%E3%83%AC%E3%83%B3%E3%82%B9/add_post_meta

春日井ナビ

管理者以外で特定カテゴリーへの投稿を制限する「admin-only-categories」

クーポン時のループ

空の時

<?php
	$args = array(
		'posts_per_page' => 6,
			'post_type' => 'shop', //カスタム投稿名
'orderby' => 'modified',//更新順
		'tax_query' => array(
			'relation' => 'AND',
			array(
				'taxonomy' => 'otherall',
				'field' => 'slug',
				'terms' => array( 'クーポン無し', '予備' ),
				'operator'=>'NOT IN'
				)
		),
		   'meta_query' => array(//カスタムフィールドによる絞り込み
            array(
                'key' => 'クーポン見出し',//カスタムフィールド名
               'value' => '',
		'compare'=>'NOT IN'
            ),
        ),
	
	);
?>

seoの話 引越 メタリフレッシュ

以上みてきましたように、meta refreshを0に設定すると、リダイレクトはされるものの、新URLが検索エンジンにインデックスされないということを確認しました。
http://web-laboratories.com/meta-refresh-0second
子の記事に寄ると

0で飛ばすと 駄目らしい

知らんかった
ラミルさんのやつで やったけど
それがいかんかったら
調整しといたがどうyが

カスタムアドミン カテゴリ部分 お客のやつ 親カテゴリとか出さない

/*新規カテゴリを作らせない*/
body.post-type-post #category-add-toggle,
body.post-type-shop #shop_cat-add-toggle{ display:none;}


/*親カテゴリ選択させない*/
#newgallery1_cat_parent,
#newmaintenance_cat_parent{ display:none;}

/*カテゴリ作成ページで親とかスラッグを消す タググラウドも
 #addtagを入れると編集ページは表示される*/

/*body.edit-tags-php #addtag .term-parent-wrap,*/
body.edit-tags-php .term-parent-wrap,
body.edit-tags-php .term-slug-wrap,
body.edit-tags-php .term-description-wrap,
body.edit-tags-php .tagcloud
{display:none;}