カレンダープラグインで URL先を JSで置き換えたメモ

結果

<script type="text/javascript">
$(document).ready(function() {
$(".monthly-calendar a").each(function() { //.eachは合致
var dreplace = null;//初期化
var dreplace = $(this).attr('href').replace(/%e7%8f%be%e5%a0%b4%e8%a6%8b%e5%ad%a6%e4%bc%9a/g,'予約カレンダー');
$(this).attr('href',dreplace);
});
});

</script>

カレンダーを入れる部分にショートコードを入れて

ページ最下部に

だと、カレンダーをクリックした先
また、同じページになってしまう。

その先をスライダーやコンテンツなどは一切読み込ませずに
新しいページで表示

カレンダー = コンテンツ下
クリック先 = 固定ページ

ブログなどのカレンダーTOPページのヘッダーに上記スクリプト

固定ページで同じショートコードでページ作成

<script type="text/javascript">
$(document).ready(function() {
$(".monthly-calendar a").each(function() { //.eachは合致
var dreplace = null;//初期化
var dreplace = $(this).attr('href').replace(/ここに元のページのURLを入れる%e7%8f%be%e5%a0%b4%e8%a6%8b%e5%ad%a6%e4%bc%9aここまで/g,'移管先URL=予約カレンダー');
$(this).attr('href',dreplace);
});
});

</script>

テンプレで
サイドバーに入れたバナーと
予約ボタンの
css 

.genba_kengaku{
	border: 1px solid #CCC;
	display: block;
	text-align: center;
}

.kengaku_title{
	font-weight: bold;
	padding-top: 12px;
	padding-right: 5px;
	padding-bottom: 12px;
	padding-left: 5px;
}
button[type="submit"]{ font-size:18px;}
<a href="/現場見学会/" class="genba_kengaku" style="margin-bottom:0px; margin-top:12px;">
<img src="/img/side_open_house.jpg" width="214" height="129" alt="名古屋市昭和区 新築完成現場見学会"/><div class="kengaku_title">
完成見学会ご予約フォーム<br />
<span style="font-size:80%; font-weight:normal">名古屋市昭和区 3月4日まで</span></div>
</a>

参考

http://www.db.gs/article/402042301.html

http://qiita.com/ma_me/items/9d2a72df209ae9832a3f

http://semooh.jp/jquery/api/core/each/callback/

http://www.webantena.net/javascriptjquery/jquery-replace/

http://www.webantena.net/javascriptjquery/jquery-replace-multiple-words/

正規表現リンク集

正規表現 メタ文字一覧
http://www.megasoft.co.jp/mifes/seiki/meta.html

サルにもわかる正規表現入門
http://www.mnet.ne.jp/~nakama/

正規表現の構文
https://msdn.microsoft.com/ja-jp/library/ae5bf541(v=vs.90).aspx

The GNU Awk User’s Guide – 正規表現
http://www.kt.rim.or.jp/~kbk/gawk-30/gawk_5.html

likeboxもといpage plugin facebook ウィジェットのレスポンシブ

	.fb_iframe_widget{ width:100%}

.fb_iframe_widget iframe{ width:100%}
<div class="fb-page" data-href="https://www.facebook.com/0568navi/" data-small-header="false" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="true" data-show-posts="true" data-width="500" ></div>

https://developers.facebook.com/docs/plugins/page-plugin

レスポンシブデザインでBootstrapを使うと便利そうだが まとめ

http://qiita.com/gaogao_9/items/ec2b867d6941173fd0b1
この記事からみつけ

本家
http://getbootstrap.com/

説明
http://www.tohoho-web.com/ex/bootstrap.html
http://techacademy.jp/magazine/6270

テンプレート
http://coliss.com/articles/build-websites/operation/work/best-templates-for-bootstrap-2015-autumn.html

↑こっから色々あった

http://sounansa.net/archives/1551

ここも

よくつかっておりそうな人のすすめ
http://megane84.com/blog/2013/12/25/post-2682/

この人の会社
http://spot-web.jp/works/
参考になりそうなcss 明朝フォント設定とか 多分 レスポンシブは+料金にしてる

名古屋の良く見る顔の人が作った
無料ワードプレステーマも
使ってみたい

http://demo.vs1.biz/lightning-worksunit-demo/
http://lightning.vektor-inc.co.jp/ja/inquiry

習得中まとめ
bootstrap-theme.css(グラデーションなどを使用したオプションのCSS)
http://bootstrap3-guide.com/base/prepare.html
フラットデザインcss
http://bootstrap3-guide.com/base/prepare_demo_no_theme.html
グラデ等使用
http://bootstrap3-guide.com/base/prepare_demo_theme.html

<span class="glyphicon 使いたいアイコンのクラス名" aria-hidden="true"></span>

http://bootstrap3.cyberlab.info/components/glyphicons.html#
aria-hidden=”true”
http://blog.e-riverstyle.com/2015/02/aria-hiddentruespeak-none.html

基本

<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

全てのcssの前に

<link rel="stylesheet" type="text/css" href="/bootstrap-3.3.6/css/bootstrap.css"/>

//jqのあとに

<!--ストラップ---->
<script type="text/javascript" src="/bootstrap-3.3.6/js/bootstrap.min.j"></script>
<!--/ストラップ---->

アイコンフォントはcssで設定されているのでアサイン必要なし

いちおこれも入れておいた方がいいかも

 <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->

css無効化

html {
  /*font-size: 10px;*/

  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
body {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
 /* font-size: 14px;*/
  line-height: 1.42857143;
  color: #333;
  background-color: #fff;
}

input[type="file"] {
/*  display: block;*/
}


ただしこれは今後有効かしてもよい
h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
  font-family: inherit;
 /* font-weight: 500;*/
/*  line-height: 1.1;*/
  color: inherit;
}
ただしこれは今後有効かしてもよい
/*h1,
.h1 {
  font-size: 36px;
}
h2,
.h2 {
  font-size: 30px;
}
h3,
.h3 {
  font-size: 24px;
}
h4,
.h4 {
  font-size: 18px;
}
h5,
.h5 {
  font-size: 14px;
}
h6,
.h6 {
  font-size: 12px;
}*/

癖としては
全てこうしたる

* {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

こうして

/*ボーダーボックスクリア*/
	.d_bb_clear{
		    -webkit-box-sizing:content-box;
    -moz-box-sizing: content-box;
    box-sizing: content-box; }

再度

<div id="D_menu_all" class="d_bb_clear">
<div id="kensaku" class="d_bb_clear">
ループ
<div id="gallery" class="d_bb_clear">

これで同じ表示
ほぼ

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日前までにお願いします。

など

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

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

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

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

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

ユーザー一覧で カスタムポストの記事数やニックネームなどを表示する方法

ファンクションへ

//ユーザーの投稿数を取得
function count_user_posttype($userid,$posttype) {
    global $wpdb;
    $where = get_posts_by_author_sql($posttype, true, $userid,true);
    $count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" );
    return $count;
}
//利用したい箇所に記述
//<?php echo count_user_posttype(get_the_author_meta('id'),"post"); ?/>


//ユーザー一覧に追加
function custom_users_columns( $columns ) {
	$columns['user_shop'] = '登録数';
	$columns['nickname'] = 'ニックネーム';
	return $columns;
}


function custom_users_custom_column( $dummy, $column, $user_id ) {
	if ( $column == 'user_shop' ) {
		$user_info = count_user_posttype($user_id,"shop");

		return $user_info;
	}
	if ( $column == 'nickname' ) {
		$user_info = get_userdata($user_id);

		return $user_info->nickname;
	}
}
add_filter( 'manage_users_columns', 'custom_users_columns' );
add_filter( 'manage_users_custom_column', 'custom_users_custom_column', 10, 3 );

参考
管理画面のユーザー一覧に項目を加える方法
http://www.sandalot.com/%E7%AE%A1%E7%90%86%E7%94%BB%E9%9D%A2%E3%81%AE%E3%83%A6%E3%83%BC%E3%82%B6%E3%83%BC%E4%B8%80%E8%A6%A7%E3%81%AB%E9%A0%85%E7%9B%AE%E3%82%92%E5%8A%A0%E3%81%88%E3%82%8B%E6%96%B9%E6%B3%95/

WordPressで指定ユーザーごとの投稿数を取得する
http://hirashimatakumi.com/blog/47.html

function count_user_posttype($userid,$posttype) {
    global $wpdb;
    $where = get_posts_by_author_sql($posttype, true, $userid,true);
    $count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" );
    return $count;
}
利用したい箇所に記述します。
<?php echo count_user_posttype(get_the_author_meta('id'),"post"); ?>

クライアントの投稿画面を調整 jsで レイアウト

ファンクション

// カテゴリ->カスタムフィールド->公開 に毎回並び替える
function my_footer() {
echo '<script type="text/javascript">
  //<![CDATA[
jQuery(function(){
jQuery("#normal-sortables").prepend(jQuery("#tagsdiv-post_tag"));
jQuery("#normal-sortables").prepend(jQuery("#postimagediv"));
jQuery("#submitdiv").appendTo(jQuery("#normal-sortables"));
});
//]]>
  </script>';
}
add_action('admin_footer', 'my_footer');

prepend 要素内の先頭に つまり先に処理したものから後の挿入処理により一個さがる2個目になる
http://semooh.jp/jquery/api/manipulation/prepend/content/

appendTo 要素内の末尾に
http://semooh.jp/jquery/api/manipulation/appendTo/content/

記録
https://ja.forums.wordpress.org/topic/3063 参考

// カテゴリ->カスタムフィールド->公開 に毎回並び替える
function my_footer2() {
echo '<script type="text/javascript">
  //<![CDATA[
  jQuery(function(){
	 //jQuery("#cfs_input_929").appendTo(jQuery("#normal-sortables"));
	//jQuery("#normal-sortables").prepend(jQuery("#side-sortables").children("#categorydiv"));
	//jQuery("#normal-sortables").append(jQuery("#side-sortables").children("#submitdiv"));
	//jQuery("#categorydiv").prependTo(jQuery("#normal-sortables"));

  });
  //]]>
  </script>';
}
add_action('admin_footer', 'my_footer2');

春日井ナビ 登録ユーザーに 一斉メールを送る Email Users まとめ

登録ユーザーは ショップオーナーとなるように設定しています。

ショップオーナーへリフォームの告知メール

Email Usersをインスト

スクリーンショット 2016-01-22 0.25.08

 

ポイントはここで

送り主を設定 返信先を設定しないとへんてこなサーバー情報が記載されてしまうので必ず書く もしくは プラグインフォルダを Reply-Toで検索して ifの部分を

//でコメントあうとする

  if (empty($return_path))
	    $headers[] = ($omit) ? sprintf('Reply-To: %s', $sender_email) : sprintf('Reply-To: "%s" <%s>', $sender_name, $sender_email);
    //$headers[] = 'MIME-Version: 1.0';

それとココの部分
スクリーンショット 2016-01-22 0.28.53

 

 

翻訳

スクリーンショット 2016-01-22 0.30.25

新規ユーザーの設定でこうしておかないと新しいポストがあったときにメールが送られてしまってうざいとおもわれるのでチェックを外す

後は

送る際に複数人だと 宛先が配信人のメアドが表示される仕組みにとまどったが

個人へ送れば 個人名がでる

情報露出防止だろう。

参考:http://techmemo.biz/wordpress/email-users/

 

こちらサーバーの件だが

迷惑メールに入らないように

サーバーでしっかり設定する事

別記事
http://www.memo.d-marking.com/?p=2199

phpで スラッグを分解して 重複タイトルの-2を 分岐条件にした詳細

preg_split — 正規表現で文字列を分割する
http://php.net/manual/ja/function.preg-split.php

<?php
// カンマまたは " ", \r, \t, \n , \f などの空白文字で句を分割する。
$keywords = preg_split("/[\s,]+/", "hypertext language, programming");
print_r($keywords);
?>

正規表現http://www.megasoft.co.jp/mifes/seiki/meta.html

“/[\s,]+/” ココの部分

//で囲む 正規表現
http://www.kt.rim.or.jp/~kbk/gawk-30/gawk_5.html

[]が一致するもの 指定したどれか
http://www.mnet.ne.jp/~nakama/

+が最低それが一個以上
http://www.mnet.ne.jp/~nakama/

実例

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

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

だいぶスキル上がったな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;

いずれ役に立ちそうな PHPからJavaScriptに変数を渡すまとめ

http://qiita.com/cither/items/b98cc4e237dcc8f7e51f

<?php
    $array = array("hoge" => "fuga");
?>
<script>
    var array = <?php echo json_encode($array, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT); ?>;
    console.log(array); // Object { hoge: "fuga" }
</script>
function json_safe_encode($data){
    return json_encode($data, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT);
}
<?php
    $null        = null;
    $string      = "hoge";
    $emptyString = "";
    $array       = array("hoge", "fuga");
    $empty_array = array();
    $asoc_array  = array("hoge" => 1, "fuga" => 2);
    $boolean     = false;
    $str_boolean = "false";
    $zero        = 0;
    $str_zero    = "0";
    $float       = 0.12;
?>
<script id="script" src="script.js"
    data-null         ='<?php echo json_safe_encode($null); ?>'
    data-string       ='<?php echo json_safe_encode($string); ?>'
    data-empty-string ='<?php echo json_safe_encode($empty_string); ?>'
    data-array        ='<?php echo json_safe_encode($array); ?>'
    data-empty-array  ='<?php echo json_safe_encode($empty_array); ?>'
    data-asoc-array   ='<?php echo json_safe_encode($asoc_array); ?>'
    data-boolean      ='<?php echo json_safe_encode($boolean); ?>'
    data-str-boolean  ='<?php echo json_safe_encode($str_boolean); ?>'
    data-zero         ='<?php echo json_safe_encode($zero); ?>'
    data-str-zero     ='<?php echo json_safe_encode($str_zero); ?>'
    data-float        ='<?php echo json_safe_encode($float); ?>'
></script>
var $script     = $('#script');
var _null       = JSON.parse($script.attr('data-null'));
var string      = JSON.parse($script.attr('data-string'));
var emptyString = JSON.parse($script.attr('data-empty-string'));
var array       = JSON.parse($script.attr('data-array'));
var emptyArray  = JSON.parse($script.attr('data-empty-array'));
var asocArray   = JSON.parse($script.attr('data-asoc-array'));
var boolean     = JSON.parse($script.attr('data-boolean'));
var strBoolean  = JSON.parse($script.attr('data-str-boolean'));
var zero        = JSON.parse($script.attr('data-zero'));
var strZero     = JSON.parse($script.attr('data-str-zero'));
var float       = JSON.parse($script.attr('data-float'));


console.log(_null);       // null
console.log(string);      // "hoge"
console.log(emptyString); // ""
console.log(array);       // Array [ "hoge", "fuga" ]
console.log(emptyArray);  // Array [  ]
console.log(asocArray);   // Object { hoge: 1, fuga: 2 }
console.log(boolean);     // false
console.log(strBoolean);  // "false"
console.log(zero);        // 0
console.log(strZero);     // "0"
console.log(float);       // 0.12

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

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

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

対策 

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

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/