Custom Field Suite 日付日本語化!!!

日付日本語化 プラグ▶fields▶date
jquery.datetime.js

変更

出力
単発

echo date('Y年m月d日', strtotime($cfs->get('birthday')));

ループ未検証

<?php $loop = new WP_Query(array("post_type" => "schedule", "posts_per_page" => 1 ));

while($loop->have_posts()): $loop->the_post(); ?>

<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

 <h2><?php the_title(); ?></h2>
 <h3><?php echo $cfs->get('title'); ?></h3>

<ul>
 <li><?php echo date('Y年m月d日', strtotime($cfs->get('date'))); ?></li>
 <li><?php echo $cfs->get('summary'); ?></li>
</ul>

 <?php $fields = $cfs->get('Schedule'); foreach ($fields as $field) { ?>

 <h3><?php echo $field['title']; ?></h3>

<ul>
 <li><?php echo date('Y年m月d日', strtotime($field['date'])); ?></li>
 <li><?php echo $field['summary']; ?></li>
</ul>
 <?php } ?>

</div>

 <?php endwhile; ?>

参考

http://brushape.com/wordpress/%E3%80%90wordpress%E3%80%91%E3%82%AB%E3%82%B9%E3%82%BF%E3%83%A0%E3%83%95%E3%82%A3%E3%83%BC%E3%83%AB%E3%83%89%E3%82%92%E7%B0%A1%E5%8D%98%E4%BD%9C%E6%88%90%E3%81%97%E3%81%9F%E3%81%8F%E3%81%A6%E3%80%8Ccu/

(ライブ)スケジュール機能

スケジュール準備

未来記事表示 No Future Post
http://imasashi.net/blog/wordpress/future-info.html

もしっくは
ファンクション未検証http://istks.net/2300

function myfunc($data, $posts) {
if ($data['post_status'] === 'future' &amp;&amp; $posts['post_status'] === 'publish') {
$data['post_status'] = 'publish';
}
return $data;
}
add_filter('wp_insert_post_data', 'myfunc', 10, 2);

ループ みけん

<?php
function filter_where($where = '') {
$where .= " AND post_date > '" . date('Y-m-d', strtotime('0 days')) . "'";
return $where;
}
add_filter('posts_where', 'filter_where');
query_posts(array(
    'cat' => ※記事カテゴリーID,
    'order' => ASC,
));?>
<?php if (have_posts()) : ?>
<?while (have_posts()): the_post(); ?>
    ※ループ中身
<?php endwhile; ?>
<?php else : ?>
    ※予定が無い場合のメッセージ
<?php endif; ?>

カテゴリーページの場合みけん

<?php
function filter_where($where = '') {
$where .= " AND post_date > '" . date('Y-m-d', strtotime('0 days')) . "'";
return $where;
}
add_filter('posts_where', 'filter_where');
query_posts(array(
'cat' => get_query_var('cat'),
'order' => ASC,
));?>

アーカイブページみけん

<?php
  function filter_where($where = '') {
    $where .= " AND post_date > '" . date('Y-m-d', strtotime('1 days')) . "'";
    return $where;
  }
add_filter('posts_where', 'filter_where');
global $query_string;
query_posts($query_string . "&order=ASC");
?>

何日間とか指定
http://wpdocs.sourceforge.jp/%E3%83%86%E3%83%B3%E3%83%97%E3%83%AC%E3%83%BC%E3%83%88%E3%82%BF%E3%82%B0/query_posts#.E6.97.A5.E6.99.82.E5.BC.95.E6.95.B0

何日から何日と指定
http://webcake.no003.info/webdesign/wp-queryposts-datesearch.html

記事が無い時ほかのページ みけん

http://ja.forums.wordpress.org/topic/21998?replies=5

本日の日付から過去30日間に書かれた最新記事を5件表示みけん
http://www.imamura.biz/blog/cms/wordpress/tips/8176

ignore_sticky_posts=1とは
http://mekemoke.jp/2012/10/428.html

検証結果===============

>< =><=がキーマン [php]function filter_where($where = '') {//フィルター $where .= " AND post_date > '" . date('Y-m-d', strtotime('0 days')) . "'";//AND post_date のあとの記号で未来過去をチェンジ return $where; } add_filter('posts_where', 'filter_where');[/php]

改行プラグイン

http://crossinthenight.com/wordpress/1710/

自動整形されるのを防ぎ意図どおりに改行する、プラグイン
「PS Disable Auto Formatting」

一度きりの自動整形解除プラグイン状態の「brBrbr」より、かなりおすすめ

IE8でCSS3

http://shouken56.net/blog/practice/web/2301/

<meta http-equiv="X-UA-Compatible" content="IE=edge">
<script src="js/respond.src.js"></script>
<!--[if lt IE 9]> 
<script src="js/html5shiv-printshiv.js"></script>//これはhtml5に対応させる
<![endif]-->

ログインしてたらの分岐

この条件分岐タグは、現在の訪問者がログインしているかチェックします。これは TRUE または FALSE の値を返す boolean 関数です。

<?php if ( is_user_logged_in() ) { ... } ?>

<?php if ( is_user_logged_in() ):?>

<?php
if ( is_user_logged_in() ) {
	echo 'Welcome, registered user!';
} else {
	echo 'Welcome, visitor!';
};
?>

Custom Field Suite のまとめ2? ループフィールドの出力方法基本

■ギャラリー

<?php
if ( have_posts () ) :
    while ( have_posts() ) :
        the_post();
?>

<!--ギャラリー取得--->
<?php
$fields = $cfs->get('shop_gallery');
foreach ($fields as $field) :
?>

<?php
 $attachment_id = $field['gallery_photo'];
 $sample_photo = wp_get_attachment_image($attachment_id,'full');
echo $sample_photo;
?>

<?php
endforeach;
?>

<?php
    endwhile;
endif;
?>

05naviの記事件数 登録 何件?

ファンクションへ
オリジナル関数だと思う

//特定のカテゴリと特定のタグで絞った記事数の表示方法
function taxonomy_found_posts_num() {
    $args = array(
'post_type' => array('shoku','asobu','share','seikatsu','iryou','manabu','koukyou','ofuroyado'), //カスタム投稿名
    );
    $my_query = new WP_Query($args);
    return $my_query->found_posts;
}

//表示箇所に
//<?php echo taxonomy_found_posts_num('hokkaido','タグ1'); 件<br />
//<?php echo taxonomy_found_posts_num('aomori','タグ2'); 件

上記正式コード

<?php
function taxonomy_found_posts_num($cat_slug,$tag_slug) {
    $args = array(
        'post_type' =>'post',
        'tax_query' => array(
            'relation' => 'AND',
            array(
                'taxonomy' => 'category',
                'field' => 'slug',
                'terms' => $cat_slug,
            ),
            array(
                'taxonomy' => 'post_tag',
                'field' => 'slug',
                'terms' => $tag_slug,
            ),
        ),
        'posts_per_page' => 1
    );
    $my_query = new WP_Query($args);
    return $my_query->found_posts;
}
?>
    <?php 

//特定のポストタイプと特定のユーザーIDで絞った記事数の表示方法
function taxonomy_found_posts_num1($post_type,$user_id) {
    $args = array(
'post_type' => $post_type, //カスタム投稿名
'author' => $user_id,
    );
    $my_query = new WP_Query($args);
    return $my_query->found_posts;
}

//ログインユーザーのIDを取得
$user = wp_get_current_user();
$user_idd = $user->get('ID')."\n"; // ID

//出力
echo taxonomy_found_posts_num1('shoku',$user_idd);
	?>

Custom Field Suite 日付

日本語化 プラグ▶fields▶date▶jquery.datetime.js
変更

出力
単発

echo date('Y年m月d日', strtotime($cfs->get('birthday')));

ループ未検証

<?php $loop = new WP_Query(array("post_type" => "schedule", "posts_per_page" => 1 ));

while($loop->have_posts()): $loop->the_post(); ?>

<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

 <h2><?php the_title(); ?></h2>
 <h3><?php echo $cfs->get('title'); ?></h3>

<ul>
 <li><?php echo date('Y年m月d日', strtotime($cfs->get('date'))); ?></li>
 <li><?php echo $cfs->get('summary'); ?></li>
</ul>

 <?php $fields = $cfs->get('Schedule'); foreach ($fields as $field) { ?>

 <h3><?php echo $field['title']; ?></h3>

<ul>
 <li><?php echo date('Y年m月d日', strtotime($field['date'])); ?></li>
 <li><?php echo $field['summary']; ?></li>
</ul>
 <?php } ?>

</div>

 <?php endwhile; ?>

参考
http://brushape.com/wordpress/%E3%80%90wordpress%E3%80%91%E3%82%AB%E3%82%B9%E3%82%BF%E3%83%A0%E3%83%95%E3%82%A3%E3%83%BC%E3%83%AB%E3%83%89%E3%82%92%E7%B0%A1%E5%8D%98%E4%BD%9C%E6%88%90%E3%81%97%E3%81%9F%E3%81%8F%E3%81%A6%E3%80%8Ccu/

投稿者のシングルページで最新記事を下部に出す。その記事を抜きで。1記事目は何も出ず。

ポイント
イフはぶポストで一回区切る
エンドワイルで一回区切る

‘post__not_in’=> array($now_post_id),

<!------------------------------最新記事------------------------------------>





<?php $user_id = get_the_author_meta( 'id' ); ?>
<?php $now_post_id= get_the_ID(); ?>
<?php
$args = array(
		'posts_per_page' => 3,
		'author'=>$user_id,
'orderby' => 'modified',//更新順
'post__not_in'=> array($now_post_id),

	);
?>
<!----/宣言----->
<!----宣言2----->
<?php
	query_posts( $args );
?>





   <?php 
 if ( have_posts () ) :?>
 
 
 ■<?php echo get_the_author_meta( 'author_nickname' ); ?>
さんの最新記事
<div style="clear:both"></div><br />

<?php
    while ( have_posts() ) :
        the_post();
?> 
   <?php include("d_blog_roop_new.php"); ?>
   
    <?php
    endwhile;?> 
	
	<div class="blog_more"><a href="<?php bloginfo('url'); ?>/?author=<?php $user_id = get_the_author_meta( 'id' ); ?><?php echo $user_id; ?>">
		 <?php echo get_the_author_meta( 'author_nickname' );
		 ?>さん のブログをみる▶</a></div>
         
   <?php         
endif;
?>





<!------------------------------リセットクエリ------------------------------------>
<?php wp_reset_query(); ?>

ポストサムネイル表示 Auto Post Thumbnail

<?php
if(has_post_thumbnail()){
 
/*サムネイルの表示*/
the_post_thumbnail(array(200,200));
 
}else{
 
/*代替え画像の表示*/
echo '<img src="http://r-ichinomiya.com/wp-content/uploads/2012/06/wpid-NEC_00144-240x240.jpg" width="200" alt="一宮スナックRのロゴ">';
 
}
?>

プラグイン
Auto Post Thumbnailを入れる

GET ATTACHMENT IMG

<?php wp_get_attachment_image( $attachment_id, $size, $icon, $attr ); ?>

//デフォルトはechoで出力
<?php echo wp_get_attachment_image(); ?>

http://wpdocs.sourceforge.jp/%E3%83%86%E3%83%B3%E3%83%97%E3%83%AC%E3%83%BC%E3%83%88%E3%82%BF%E3%82%B0/wp_get_attachment_image

<?php wp_get_attachment_image_src( $attachment_id, $size, $icon ); ?>

戻り値

(配列)
配列は以下を含みます:
[0] => url
[1] => width
[2] => height
[3] => 真偽値: リサイズされいている場合は true、元のサイズの場合は false

http://wpdocs.sourceforge.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/wp_get_attachment_image_src

CSS3でとfanctionでユーザープロフィール画面を整理する

#profile-page h3,
#profile-page table:nth-of-type(1) tr:nth-child(1),
#profile-page table:nth-of-type(1) tr:nth-child(2),
#profile-page table:nth-of-type(1) tr:nth-child(3),
#profile-page table:nth-of-type(2) tr:nth-child(2),
#profile-page table:nth-of-type(2) tr:nth-child(3),
#profile-page table:nth-of-type(2) tr:nth-child(4),
#profile-page table:nth-of-type(2) tr:nth-child(5),
#profile-page table:nth-of-type(3) tr:nth-child(2),
#profile-page table:nth-of-type(4) tr:nth-child(1)
{
	display: none;
}

ファンクション

//プロフィール画面でビジュアルエディターのチェックボックスを隠す
function hide_richeditor_checkbox() {
    global $wp_rich_edit_exists;
    if ( ! current_user_can( 10 ) && defined( 'IS_PROFILE_PAGE' ) && IS_PROFILE_PAGE ) {
        $wp_rich_edit_exists = false;
    }
}
add_action( 'admin_head', 'hide_richeditor_checkbox' );


//ユーザープロフィールの「管理画面の配色」を削除
remove_filter( 'admin_color_scheme_picker', 'admin_color_scheme_picker' );

//管理画面の配色を強制的に青
function admin_color_force_fresh() {
	return 'classic';
}
add_filter( 'get_user_option_admin_color', 'admin_color_force_fresh' );


//管理画面文字変更
add_filter('gettext', 'change_post_to_article');
add_filter('gettext_with_context', 'change_post_to_article');
add_filter('ngettext', 'change_post_to_article');
add_filter('ngettext_with_context', 'change_post_to_article');

function change_post_to_article($translated) {
    $translated = str_ireplace(
        'プロフィール',
        'パスワードの変更',
        $translated
    );
    return $translated;
}

//このcssでCSS3を使って項目見えなくする
//CSSで管理画面内のサイドメニューを非表示にする 権限指定
function custom_admin_styles(){
$current_user = wp_get_current_user(); //現在のユーザー情報を取得
        if(check_user_role($current_user,'shop_owner')){ //編集者(editor)かチェック
            echo '<link rel="stylesheet" type="text/css" href="' .get_bloginfo('template_directory'). '/custom-admin-css2.css" />';
        }
		if(check_user_role($current_user,'editor')){ //編集者(editor)かチェック
            echo '<link rel="stylesheet" type="text/css" href="' .get_bloginfo('template_directory'). '/custom-admin-css2.css" />';
        }
		
		
    }
    add_action('admin_print_styles', 'custom_admin_styles', 21);

    /*
     * ユーザーの権限をチェックする
     * @param $user ユーザーオブジェクト
     * @param $role ユーザー権限の文字列
     *      (administrator, editor, author, contributor, subscriber)
     */
    function check_user_role($user,$role){
        foreach($user->roles as $user_role){
            if($user_role === $role){
                return true;
            }
        }
        return false;
    }

http://qiita.com/koh-taka@github/items/79309c1f367f00c425d8