シンプルカスタムで
コンテンツを追加
出力
https://ja.wordpress.org/support/topic/smart-custom-fields%E3%81%AEwysiwyg-%E3%83%95%E3%82%A3%E3%83%BC%E3%83%AB%E3%83%89%E6%8A%95%E7%A8%BF%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6/
<?php
$cf_sample = SCF::get('aaa');
echo wp_kses_post($cf_sample);
?>
但しクイックタグが利用できないので
自作クイックタグを テキストの方で
表示させる
テーブル
追加する
プラグイン不要!WordPressのテキストエディタにタグ挿入クイックタグボタンを追加する方法
WordPressで脱プラグイン!AddQuicktagを使わないでコード挿入ボタンを増やす方法
カスタムアドミン
/*welcart*/
.size_table th{background: #ececec;text-align: center;}
.size_table td{text-align: center;}
.size_table th,.size_table td{padding: 10px;}
xserverの管理画面でssl対応する
アップしたワードプレスの設定をhttpsに変更
htaccessに
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
を追加
ラインウィジェットのアイコン画像のurlをhttpsに
google jsを
http://から
//
にする。
コンテンツエディタで投稿したものは
http になっているので
すべてhttpsに変換するべし
プラグインありそう
OK
カテゴリー: Code コード
河島 製作時 追加
.mob_br{display: inline-block}
スライダー おかいしい コード
<?php if(!is_home()):?></div><? endif;?>
スライダー モブ
.sl_under_p{ font-size:14px;width:80%; margin:0 auto;
margin-bottom:24px;}
con
.service_chiiki{
a{display: inline-block;}
a:after{content:",\00A0";}
overflow: hidden;
//li{float: left;}
//li a:after{content:",\00A0";}
}
ファンク 地域
function cptui_register_my_taxes_service_chiiki() {
/**
* Taxonomy: 周辺地域.
*/
$labels = array(
"name" => __( '対応地域', '' ),
"singular_name" => __( '対応地域', '' ),
);
$args = array(
"label" => __( '対応地域', '' ),
"labels" => $labels,
"public" => true,
"hierarchical" => true,
"label" => "対応地域",
"show_ui" => true,
"show_in_menu" => true,
"show_in_nav_menus" => true,
"query_var" => true,
"rewrite" => array( 'slug' => '対応地域', 'with_front' => true, ),
"show_admin_column" => false,
"show_in_rest" => false,
"rest_base" => "",
"show_in_quick_edit" => false,
);
register_taxonomy( "service_chiiki", array( "site","post" ), $args );
}
add_action( 'init', 'cptui_register_my_taxes_service_chiiki' );
親子無視リストなし
<div class="side_shop service_chiiki" style="margin-top:20px;">
★対応地域<br>
<?php
$args = array(
'show_option_all' => '',
'orderby' => 'name',
'order' => 'ASC',
'style' => 'none',
'show_count' => 0,
'hide_empty' => 0,
'use_desc_for_title' => 1,
'child_of' => 0,
'feed' => '',
'feed_type' => '',
'feed_image' => '',
'exclude' => '',
'exclude_tree' => '',
'include' => '',
'hierarchical' => 1,
'title_li' => __( '' ),
'show_option_none' => __( '' ),
'number' => null,
'echo' => 0,
'depth' => 0,
'current_category' => 0,
'pad_counts' => 0,
'taxonomy' => 'service_chiiki',
'walker' => null
);
$list = wp_list_categories( $args );
$list = str_replace("<br />", "", $list);
echo $list;
?>
<div style="clear:both"></div>
その他地域もお気軽にご相談下さい。
</div>
ブログサイドバー用 分岐+ ドロップダウン
買取地域は 別にタクソノミー
<?php if(is_page('ブログトップ') || is_page('blog-all') || is_category() ||is_tag()||is_month()||is_author() || is_singular('post')||is_tax('blog_chiiki')) :?>
<h3 class="side_blog_cat_title">
<a href="<?php echo home_url(); ?>/ブログトップ/">
古本出張買取ブログ</a>
</h3>
<div style="padding-top:20px;"></div>
<ul class="blog_side_menu">
<?php wp_list_categories(array(
'title_li' => '',//最初に何も入れない 入れると<li class="categories">入れた文字<ul>リスト一覧</ul></li>となる
'taxonomy' => 'category', //カテゴリ
'show_count' => 0,
'hide_empty' => 0, //記事がなくとも表示
'orderby' => 'order',//順番は指定します
'depth' => 0,//子は表示しません。
'exclude' => 30,
)); ?>
</ul><br>
<ul class="car_side_menu">
<?php $cats = get_categories(array(
'post_type' => 'post',
'taxonomy' => 'blog_chiiki' ,
'hide_empty' => 0 ,//記事がなくとも表示
'depth' => 1,//子は表示しません。
'orderby' => 'order',//順番は指定します
)); ?>
<?php if(!empty($cats)): ?>
<select name="cat" id="cat">
<option value=" ">古本出張買取地域</option>
<?php foreach($cats as $cat): ?>
<option value="<?php $cat_term = $cat->slug; echo get_term_link($cat_term ,'blog_chiiki'); ?>"><?php echo $cat->cat_name; ?>(<?php echo $cat->count; ?>)</option>
<?php endforeach; ?>
</select>
<script type="text/javascript">
var dropdown = document.getElementById("cat");
function onCatChange(){
if(dropdown.options[dropdown.selectedIndex].value != ""){
location.href = dropdown.options[dropdown.selectedIndex].value;
}
}
dropdown.onchange = onCatChange;
</script>
<?php endif; ?>
</ul>
<br>
<br>
<?php endif; ?>
シングル追加 カテゴリに地域
<div class="blog_deta"><ul><li><?php the_time('Y.m.d'); ?></li><li class="blogcate_icon"><?php the_category(', '); ?>
<?php echo get_the_term_list( $post->ID, 'blog_chiiki', ', ', ', ', '' ); ?>
</li></ul>
アーカイブに追加
<h2 class="h2_class">
BLOG <? if(is_tag()):?>タグ:<? elseif(is_tax('blog_chiiki')):?>古本出張買取実績:<? else:?> カテゴリ:<? endif;?><?php single_term_title(); ?>
</h2>
タクソノミーに追加
<?php elseif(is_tax('blog_chiiki')):?>
<?php include( get_stylesheet_directory() . '/archive.php'); ?>
<?php endif; ?>
カテゴリから説明と画像を取得
<!--個-->
<h3 class="h3_class2" style="margin-bottom:30px;">趣味の本の出張買取 <span class="d_price"></span></h3>
<?php
$tarmname = '趣味の本 出張買取';
$tarm_id = get_category_by_slug($tarmname)->term_id;//ここまでディスプ&画像
$post_id = 'category_'.$tarm_id;
$catimg = get_field('cat_img',$post_id);
$img = wp_get_attachment_image_src($catimg, 'd_jirei_img');
?>
<div style="position:relative; float:left;">
<? if($catimg):?>
<img src="<?php echo $img[0]; ?>" width="320" class="img_left img_waku" alt="<?php echo $tarmname; ?>|<?php echo $alt1; ?> ">
<?php else: ?>
<img src="<?php echo get_stylesheet_directory_uri(); ?>/d/img/page_sam2.jpg" width="320" class="img_left img_waku" alt="キーワード|<?php echo $alt1; ?> ">
<?php endif; ?>
</div>
<p>
<?php
echo category_description($tarm_id); ?>
<br>
</p>
<?php //関連制作事例コード
$taxonomy_name = 'category';
$args = array(
'slug' => $tarmname
);
$taxonomy_term = get_terms($taxonomy_name,$args);
if(!is_wp_error( $taxonomy_term) && count( $taxonomy_term)):
$url = get_term_link($tarmname, $taxonomy_name);
?>
<div class="jirei_link">
<a href="<?php echo $url; ?>" class=" link_bottan"><?php echo $tarmname; ?>実績 ▶▶</a>
</div>
<?php
endif; //--------ここまで
?>
<div style="clear:both"></div>
<br>
サービス地域の最下段 あればブログ 出す
<?php //------------ブログあれば出す
$cat_name = single_term_title("", false);
$args = array(
'posts_per_page' => 3,
'post_type' => 'post', //カスタム投稿名
'cat' => $info_cat_out,
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'blog_chiiki',
'field' => 'slug',
'terms' => $cat_name,
//'operator'=>'NOT IN'
),
),
// 'category_name' => $cat_name,
)
?>
<?php
$myposts = get_posts( $args );
if( $myposts){ echo '
<br><br>
<h2 class="h2_class">'. $cat_name .'出張買取実績</h2>
<div class="flex_box" style="padding-top:24px;">
';}
foreach ( $myposts as $post ) : setup_postdata( $post ); ?>
<?php include(get_stylesheet_directory() . "/d_roop/a_blog_box1.php"); ?>
<?php endforeach;
if( $myposts){ echo '
</div>
<div class="tsuzuki_box">
<a href="/blog_chiiki/'. $cat_name .'/" class="link_all link_bottan" style=" font-size:13px;">すべて見る ▶▶</a>
</div>
';}
wp_reset_postdata();//------------ブログあれば出す ?>
問い合わせ促しと ブログカテゴリサイド と 丸画像の見出し
css 印と
//tel_mail_box
@mail_color:#8c6239;
.info_mail_box{ width: 100%; margin-top: 84px;
position: relative;
.info_mail_box_h2{ padding: 12px; background: lighten(@mail_color,0%); color: #fff; font-size: 14px;}
.info_mail_box_h3{padding: 12px 12px; font-size:24px; font-weight: bold;
// border-left: solid 1px #8c6239;
// border-right: solid 1px #8c6239;
background: lighten(@mail_color,55%);
}
.tel_mail_box{background: @mail_color; color: #fff;
.flex_box;
.com__box{width: 100%; font-size: 20px;padding: 12px 24px 0 24px;}
.tel__box{padding: 0px 24px 12px 24px; width: 50%;
.tell{font-family: 'Roboto Condensed', sans-serif; font-size: 52px; }
.tell_time{ font-size: 17px; padding: 12px; text-align: center; background: lighten(@mail_color,10%);}
}
.mail__box{padding: 0px 24px 12px 24px; width: 50%;
text-align: center;
.mailform_bottan{width: 100%; display: inline-block;}
.mail_time{text-align: left; padding: 12px;}
z-index: 1;
}
.man_photo{position: absolute; right: 0; margin-top: -82px;z-index: 0}
}
}
@media screen and (max-width: 736px) {
.info_mail_box{
.info_mail_box_h2{ font-size: 13px;}
.info_mail_box_h3{font-size:20px;
}
.tel_mail_box{
.flex_box;
.com__box{width: 100%; font-size: 18px;}
.tel__box{ width: 100%;
.tell{font-size: 44px;}
.tell_time{ font-size: 14px;}
}
.mail__box{width: 100%;
.mailform_bottan{width: 100%; margin-top: 0px; }
.mail_time{display: none;}
z-index: 1;
}
.man_photo{ margin-top: 162px; display: none;
max-width: 100px;
img{width: 100%; height: auto;}
}
}
}
}
.page_img1{float: right; width: 24%; margin-right: 12px; img{width: 100%}}
@media screen and (max-width: 736px) {
.page_img1{ width: 44%; }
}
//ブログメニュー
@side_color:#956743;
.side_blog_cat_title a {display: block; padding: 12px; background: @side_color; color: #fff}
.blog_side_menu li a{display: block;
background: #fff;
margin-bottom: 6px;
padding: 6px 12px;
border-left: solid 4px @side_color}
.blog_side_menu li a:hover{background: @side_color; color: #fff; text-decoration: none;}
全部
if (!empty($terms) && !is_wp_error( $terms)) {
じゃないといかん
もしくは
カテゴリと同じくelse
car を g2バイクに直した時に出た修正
disp.php
elseif(is_post_type_archive( 'car' )){
$disp = '中古原付バイク販売TOP';//falseで出力せん //single_term_titleでも同じ
//過去の出演予定判断
$sortset = (string)filter_input(INPUT_GET, 'sort');
if ( $sortset == 'newer' ) :
$disp = '中古原付バイク販売TOP|新着順';
elseif ( $sortset == 'car_price_low' ) :
$disp = '中古原付バイク販売TOP|低価格順';
elseif ( $sortset == 'car_price_high' ) :
$disp = '中古原付バイク販売TOP|高価格順';
elseif ( $sortset == 'car_km_low' ) :
$disp = '中古原付バイク販売TOP|走行距離が短い順';
elseif ( $sortset == 'car_year_new' ) :
$disp = '中古原付バイク販売TOP|年式が新しい順';
elseif ( $sortset == 'car_cc_big' ) :
$disp = '中古原付バイク販売TOP|排気量が大きい順';
elseif ( $sortset == 'car_cc_big' ) :
$disp = '中古原付バイク販売TOP|排気量が小さい順';
endif;
$description = $disp . $disp_page .' | '. $disp_base;
}
d_h_title
//カスタムポストタイプアーカイブ指定
//car TOPなら
elseif(is_post_type_archive( 'car' )):
$disp = '中古原付バイク販売TOP';
//並び替え判断
$sortset = (string)filter_input(INPUT_GET, 'sort');
if ( $sortset == 'newer' ) :
$disp = '中古原付バイク販売TOP|新着順';
elseif ( $sortset == 'car_price_low' ) :
$disp = '中古原付バイク販売TOP|低価格順';
elseif ( $sortset == 'car_price_high' ) :
$disp = '中古原付バイク販売TOP|高価格順';
elseif ( $sortset == 'car_km_low' ) :
$disp = '中古原付バイク販売TOP|走行距離が短い順';
elseif ( $sortset == 'car_year_new' ) :
$disp = '中古原付バイク販売TOP|年式が新しい順';
elseif ( $sortset == 'car_cc_big' ) :
$disp = '中古原付バイク販売TOP|排気量が大きい順';
elseif ( $sortset == 'car_cc_big' ) :
$disp = '中古原付バイク販売TOP|排気量が小さい順';
endif;
echo $disp.' | ';
FB OG が アーカイブの設定が出来ていない模様
タイトル等設定してからやる
car.css
.flickSlider .flickThumb {
width: 100%;
overflow: hidden;
margin-top: 6px;
カスタム の 車 その他 が 投稿タイプなってない
メーカー car_maker が変わらないのはcar_maker がいけない
car_maker2にすると かわらないのが治った
特にテンプレの変更箇所ない
走行距離においては
数字で入れていないので
'type' => 'DECIMAL(3,1)', //値のタイプ 数字
としなければならない
参照
https://hacknote.jp/archives/24699/
シングルいらない
<td colspan="4" class="td_titel">
<!-- <?php echo implode( ',', $names ); //ターム名区切り文字を指定 ?> -->
<?php the_title(); ?>
hihead しんぐるcar いらない
<?php elseif ( is_singular('car') ) : //--中古車販売 個ページなら--?>
<h1 class="head"><?php
if(mb_strlen($wp_title.$h1_head_min, 'utf-8') > '77'):
$h1_title = mb_substr($wp_title.$h1_head_min, 0, 77, 'utf-8') .'…';
else:
$h1_title = mb_substr($wp_title.$h1_head_min, 0, 77, 'utf-8');
endif;
echo $h1_title
?></h1>
あっても
小カテゴリがひょうじされたりおやがひょうじされたり
タイトルを直した
ブログにタクソノミーを使っていないので
簡単にis_taxで分岐
part_blog_top.phpをゲットポスト
a_blog_box2.php alt 古い
f4 int
body 下に
/*テキストリンク*/
.jirei_link a{color:@link_color; border: solid 1px @link_color; padding: 12px; display: inline-block;}
.jirei_link a:hover{text-decoration: none; color:#fff; background: @link_color;}
blog1box
cat.php がない てかやめる
ファンク追加 印と
//get_the_categoryにかわりで特定のカテゴリを除外するコードの書き方
function my_get_the_category( $id = false, $exclude = array() ) {
$cats = get_the_category( $id );
$excluded_cats = array();
foreach( $cats as $cat ) {
if ( !in_array( $cat->cat_ID, $exclude ) ) {
$excluded_cats[] = $cat;
}
}
return $excluded_cats;
}
//書き方
//$category = my_get_the_category(false, array(1, 2));
複数のパンくずリストを出す welcart
ファンクション
//パンくずに仕様 get_category_parentsでは商品がでてしまうのでコレを作る
function my_category_parents( $id, $link = false, $separator = '/', $nicename = false, $visited = array() ) {
$chain = '';
$parent = &get_category( $id );
if ( is_wp_error( $parent ) )
return $parent;
if ( $nicename )
$name = $parent->slug;
else
$name = $parent->name;
if ( $parent->parent && ( $parent->parent != $parent->term_id ) && !in_array( $parent->parent, $visited ) ) {
$visited[] = $parent->parent;
$chain .= my_category_parents( $parent->parent, $link, $separator, $nicename, $visited );
}
//除外したいカテゴリIDを入れる
if ( ! in_array( $parent->term_id, array( 287 ) ) ) {
if ( $link )
$chain .= '<a href="' . get_category_link( $parent->term_id ) . '" title="' . esc_attr( sprintf( __( "View all posts in %s" ), $parent->name ) ) . '">'.$name.'</a>' . $separator;
else
$chain .= $name.$separator;
}
return $chain;
}
シングル
<div id="top_navi">
<?php
//記事中のすべてのカテゴリを取得
$categories = get_the_category();
//カテゴリがある場合の実行
if ( $categories ) {
//カテゴリの数だけ繰り返す
foreach( $categories as $category ) {
//カテゴリを親まで辿って表示
//商品を表示させないためファンクションで作成したget_category_parentsの変形
echo my_category_parents($category->cat_ID,true," > ").get_the_title()."<br>";
}
}
?>
</div>
楽天のような複数のパンクズに
さらに商品というリンクを消す
地域一括登録 タクソノミー 全国
保護中: デスクトップにあったメモ 春日井ナビ メール投稿 など
welcartまとめ追加2
てかリターンを覚えた
アーカイブで
頭に
<?php //--------------------------------商品アーカイブなら if( in_category( 'item' ) || //親カテゴリスラッグで分岐 ファンクションコード使用 post_is_in_descendant_category( get_term_by( 'slug', 'item', 'category' ))): ?> <?php include(get_stylesheet_directory() . "/d_parts/welcart/welcart-archive.php"); ?> <? return; endif;?>
というのを入れてリターンすると
アーカイブのときこのテンプレートを読むだけでになる
ただし、ブログTOPにも商品カテゴリをアウトしてやらなければならないので
ファンクションに商品カテIDを追加
ファンクに書いたが
//<?php query_posts('post_type=post&cat='.$info_cat_out.','.$welcart_cat_out .'&paged='.$paged); ブログトップ
//<?php query_posts('post_type=post&posts_per_page=12&cat='.$info_cat_out.','.$welcart_cat_out .'&paged='.$paged); //記事すべて読む
と入れ替えてやる
また売り切れの分岐
カートに入れるコード
<?php if(!usces_have_zaiko() ) : ?>
売り切れ
<?php else:?>
<?php usces_the_itemSkuButton(__('Add to Shopping Cart', 'usces'), 0); ?>
<?php endif;?>
welcartまとめ追加
ポストタイプはシングルを使っている
カテゴリはitemが作成され(カテゴリーに)
その子カテゴリでカテゴリー分けする
ブログと混合するので
シングルは シングル内で分岐する
<?php if ( usces_is_item() ) : //----------------------------商品だったら ?>
アーカイブはpost_is_in_descendant_category
をファンクションで定義して分岐する、(商品カテゴリーは親カテゴリーアイテムを自動チェックできないため)
http://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/in_category
<?php //--------------------------------商品アーカイブなら if( in_category( 'item' ) || //親カテゴリスラッグで分岐 ファンクションコード使用 post_is_in_descendant_category( get_term_by( 'slug', 'item', 'category' ))): ?>
管理画面 商品マスターで商品を管理するが
カスタムフィールドを追加したい場合
ブログ投稿にも、カスタムフィールドが表示される
それを回避するために、ブログ投稿画面で表示で表示させ
カスタムフィールドをcssでい表示にさせ、商品ページのみひょうじさせる。
例はシンプルカスタムフィールド
カスタムフィールドスイートはコピーすると変になるらしい
アドバンスはどうか?
#smart-cf-custom-field-1289,
#smart-cf-custom-field-1270
{
display: none;
}
.welcart-shop_page_usces_itemedit #smart-cf-custom-field-1289,
.welcart-shop_page_usces_itemedit #smart-cf-custom-field-1270
{display:inherit;}
商品画像を取得するコードが2種類しかないので
フルサイズか 近いサイズ だろう なのでそのサイズの画像を用意しておかないと
フルサイズを取得しないといけないので重くなる
<?php usces_the_itemImage( 0, 100, 100 ); ?>
<a href="<?php usces_the_itemImageURL(0); ?>"><?php usces_the_itemImage(); ?></a>
https://www.welcart.com/documents/archives/673
<?php usces_the_itemImage($id, 784, 588, $post); ?>
こうしたがドルポストの意味はよくわからない
画像にクラスを付けられないので
その前のクラスなどで .class img などしないといけない
カスタムできる参考あり
https://wpcoding.net/welcart_usces_the_itemimage_alt/
https://www.welcart.com/community/forums/topic/%E3%82%B5%E3%83%96%E7%94%BB%E5%83%8F%E3%81%AE%E4%BB%A3%E6%9B%BF%E3%83%86%E3%82%AD%E3%82%B9%E3%83%88%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6
https://www.welcart.com/community/forums/topic/%E5%95%86%E5%93%81%E3%82%A4%E3%83%A1%E3%83%BC%E3%82%B8%E3%83%87%E3%83%BC%E3%82%BF%E3%81%ABname%E3%81%AE%E3%83%91%E3%83%A9%E3%83%A1%E3%83%BC%E3%82%BF%E3%82%92%E8%BF%BD%E5%8A%A0%E3%81%97%E3%81%9F%E3%81
コレをファンクションに追加
//商品画像のaltをタイトルにする
add_filter('usces_filter_img_alt' , 'my_img_alt_func' , 10 ,2);
function my_img_alt_func(){
global $usces;
$item_title = usces_the_itemName('return');
$alt = 'alt="'.$item_title.'"';
return $alt;
}
wordpress 引越し 別サイトへ 記事移行
http://www.weblog-life.net/entry/2016/03/03/060000
エクスポートはWP CSV Exporterを使う
文字化けしますのでテキストエディタで開きます。
CSVファイルには画像のURLがエクスポートしたドメインになっているためここで置き換えます。
検索文字列:http://旧ドメイン/
置換文字列:http://新ドメイン/
インポートはReally Simple CSV Importerで挿入
flex box のベンダープリフィックス
http://blues25.com/wp/2016/01/31/flexbox_browser/
| デフォルト | Safari用 | IE10用 | Android 標準ブラウザ用 |
|---|---|---|---|
| display: flex | display: -webkit-flex | display: -ms-flexbox | display: -webkit-box |
| flex-direction: row | -webkit-flex-direction: row | -ms-flex-direction: row | -webkit-box-orient: horizontal-webkit-box-direction: normal |
| flex-direction: column | -webkit-flex-direction: column | -ms-flex-direction: column | -webkit-box-orient: vertical-webkit-box-direction: normal |
| justify-content: center | -webkit-justify-content: center | -ms-flex-pack: center | -webkit-box-pack: center |
| justify-content: flex-start | -webkit-justify-content: flex-start | -ms-flex-pack: start | -webkit-box-pack: start |
| justify-content: space-around | -webkit-justify-content: space-around | -ms-flex-pack: justify | -webkit-box-pack: justify |
| justify-content: space-between | -webkit-justify-content: space-between | -ms-flex-pack: justify | -webkit-box-pack: justify |
| align-items: center | -webkit-align-items: center | -ms-flex-align: center | -webkit-box-align: center |
arrayアレイ 中身 確認 アドバンスカスタムフィールドでユーザーを選んだ時の中身
<?php
$user = get_field('staff_user_id');
print_r($user);//中身を確認
?>
そうすると
これが入ってました。
Array ( [ID] =>
[user_firstname] =>
[user_lastname] =>
[nickname] =>
[user_nicename] =>
[display_name] =>
[user_email] =>
[user_url] =>
[user_registered] =>
[user_description] =>
[user_avatar] => )
echo $user['ID'];
で出力出来るかと思います。
複数のssh をmac管理ターミナルハイプラン時
id_rsa.pub を削除
/Users/doggstar/.ssh にid_rsa を入れる(入れ替える) 情報を見る 拡張子削除 パーミッション 自分以外禁止
KEN設計 予約フォーム
まず今あるフォームを使う
ポイントは
シングルに書いてあるスクリプト
<script type="text/javascript">
$(document).ready(function() {
$(".monthly-calendar a").each(function() { //.eachは合致
var dreplace = null;//初期化
var dreplace = $(this).attr('href').replace(/s%e6%a7%98%e9%82%b8%e7%8f%be%e5%a0%b4%e8%a6%8b%e5%ad%a6%e4%bc%9a/g,'予約カレンダー');
var dreplace = $(this).attr('href').replace(/%e5%90%8d%e5%8f%a4%e5%b1%8b%e5%b8%82%e5%8d%83%e7%a8%ae%e5%8c%bay%e6%a7%98%e9%82%b8-%e5%ae%8c%e6%88%90%e8%a6%8b%e5%ad%a6%e4%bc%9a/g,'予約カレンダー');
$(this).attr('href',dreplace);
});
});
</script>
/~/のパーマーリングをコピって
gを+している それを /予約カレンダー/変え へ飛ばしている
var dreplace = $(this).attr('href').replace(/リンク/g,'予約カレンダー');
これでそのページで切り替わらないのでページ最下段に設置しても大丈夫
固定ページにそのぺーじがある
サンクスページ?も
日曜の午後を✗にするには
予約カレンダーから日にちを選び
時間帯を1と入力する
ファルコンでユーザープロフィール 入れた時の手順
春日井ナビみてコード
カスタム
<!-- 投稿者プロフィール -->
<div class="blog_prof">
<div class="blog_prof_sam">
<?php echo get_avatar(get_the_author_id(), 100); ?>
</div>
<div class="blog_prof_disp">
<div class="blog_nickname">
<!----ブログネーム------>
<div style="font-size: 90%;">
編集者</div>
<a href="<?php echo get_author_posts_url( get_the_author_id() ); ?>">
<?php
echo get_the_author_meta('nickname');
?> </a>
<br />
<div class="mob_both">
<!-- disp -->
<?php the_author_meta('description'); ?>
<br>
<!-- sns -->
<? if(get_the_author_meta('twitter')):?>
<a href="<?php the_author_meta('twitter'); ?>" target="_blank">twitter</a>
<? endif;?>
<? if(get_the_author_meta('facebook')):?>
<a href="<?php the_author_meta('facebook'); ?>" target="_blank">facebook</a>
<? endif;?>
<? if(get_the_author_meta('instagram')):?>
<a href="<?php the_author_meta('instagram'); ?>" target="_blank">instagram</a>
<? endif;?>
<? if(get_the_author_meta('tumblr')):?>
<a href="<?php the_author_meta('tumblr'); ?>" target="_blank">tumblr</a>
<? endif;?>
</div>
</div>
</div>
</div>
<!-- //投稿者プロフィール -->
プラグインは
Simple Local Avatars
DLして入れた古いけど
https://ja.wordpress.org/plugins/simple-local-avatars/
sns出すために
アドバンスカスタムフィールドで
ユーザーに新規カスタムフィールドをつけて あればで分岐
ここにhttp://techmemo.biz/wordpress/author-meta-display/
the_author_metaで取得とあったが
出力してしまうので
get_the_author_metaというのを発見しつかった。
上記こーどのまま
オーサーアカイブでも使ったが
<?php the_author_meta('display_name',$author); ?>
こうした方が本当かも?$authorなくてもでたからいいか?
アーカイブのURLがユーザーIDになるので
Edit Author Slug
を入れて変更した。プロフページにて
http://hublog.biz/bwpb/user-settings/
css
//ユーザー
.blog_prof{ margin-top: 50px; overflow: hidden ; a{color: #1b95e0} a:hover{color: #1b95e0;} line-height: 2}
.blog_prof_sam{float: left; margin-right: 30px; img{.border-radius(50%)}}
.mob_both{font-size: 80%; clear: both;}
.blog_prof_disp{overflow: hidden; }
@media screen and (max-width: 736px) {.blog_prof_disp{overflow: initial; margin-top: 16px;}
.mob_both{padding-top: 6px;}
}
管理画面 投稿タイプ エディタースタイル
/**
ページ投稿タイプのみ違ったエディタースタイルを入れる
* Registers an editor stylesheet for the current theme.
*
* @global WP_Post $post Global post object.
*/
function wpdocs_theme_add_editor_styles() {
global $post;
$my_post_type = 'page';
// 新規投稿 (initフック).
if ( stristr( $_SERVER['REQUEST_URI'], 'post-new.php' ) !== false
&& ( isset( $_GET['post_type'] ) === true && $my_post_type == $_GET['post_type'] ) ) {
//ここから
add_editor_style('../../../css/item.css');
add_editor_style('../../../css/d_master.css');
add_editor_style('../../../css/d_temp1.css');
add_editor_style('../../../css/big_sapce.css');
//ここまで
}
// 投稿の編集 (pre_get_postsフック).
if ( stristr( $_SERVER['REQUEST_URI'], 'post.php' ) !== false
&& is_object( $post )
&& $my_post_type == get_post_type( $post->ID ) ) {
//ここから
add_editor_style('../../../css/item.css');
add_editor_style('../../../css/d_master.css');
add_editor_style('../../../css/d_temp1.css');
add_editor_style('../../../css/big_sapce.css');
//ここまで
}
}
add_action( 'init', 'wpdocs_theme_add_editor_styles' );
add_action( 'pre_get_posts', 'wpdocs_theme_add_editor_styles' );
インフォメーションのアイコン うまく表示できない 強引な並び替え
<?php
// カテゴリー情報を取得
$info_cat = get_the_category();
$info_cat1 = $info_cat[1]; // 0が親11がその子・・ファンクションの並び順をオーダー通りに出力のおかげ
$cat_name = $info_cat1->cat_name;
$info_cat2 = $info_cat[0]; //
$cat_name2 = $info_cat2->cat_name;
?>
<?php if ($cat_name == 'インフォメーション' or empty($cat_name)) :?>
<?php if ($cat_name2 == 'インフォメーション') :?>
<div class="info_cat i_info">INFO</div>
<?php else: ?>
<div class="info_cat i_info">column</div>
<?php endif; ?>
<?php //elseif ($cat_name == 'CAMPAING' ) :<div class="info_cat i_campain">CAMPAING</div>?>
<?php //elseif ($cat_name == '求人' ) :<div class="info_cat i_kyuujin">求人</div>?>
<?php //elseif ($cat_name == 'SALE' ) :<div class="info_cat i_sale">SALE</div> ?>
<?php elseif ($cat_name == 'EVENT' ) :?>
<div class="info_cat i_event">EVENT</div>
<?php elseif ($cat_name == 'MEDIA' ) :?>
<div class="info_cat i_media">MEDIA</div>
<?php elseif ($cat_name == 'NEWS' ) :?>
<div class="info_cat i_news">NEWS</div>
<?php endif; ?>
<div class="set_title">
<?php if(post_custom('info_url')): ?>
<a href="<?php echo post_custom('info_url'); ?>"><?php the_title(); ?></a>
<?php else: ?>
<?php if($post->post_content=="") : //本文空なら?><?php the_title(); ?>
<?php else: //?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<?php endif; ?>
<?php endif; ?>
</div>
</div>
このうようなコードがあると思う。
get_the_category();
でインフォメーションを0に取得したい場合
カテgリーオーダーで
インフォメーションを一番上に持ってきてやると
それが可能になるようだ。
滅多にないが レスポンシブルで 正方形の中に 縦横比不規則な画像を常に中心揃えで入れたい
http://qiita.com/ryounagaoka/items/a98f59347ed758743b8d
http://www.memo.d-marking.com/blog/2017/05/11/car-%E3%81%A7%E3%80%80%E3%82%AE%E3%83%A3%E3%83%A9%E3%83%AA%E3%83%BC%E3%81%A7%E3%80%80%E8%89%B2%E3%80%85/
http://qiita.com/7968/items/eddfeb4b424d7c2d2d34
co.d-marking の 制作事例 一覧d_jirei.php で使用
cssは
.jirei_box_img2{
border: 1px solid #CCC;
position: relative;
width: 100%;
background-image: url(../img/body_backgr/body_background_dark15.png);
background-repeat: repeat;
img{ max-width:100%; max-height:100%;
position: relative;
top: 50%;left: 50%;
-webkit-transform: translateY(-50%) translateX(-50%);
-ms-transform: translateY(-50%) translateX(-50%);
transform: translateY(-50%) translateX(-50%);
}
}
.jirei_box{
width: 31%;
margin-right: 1%;
margin-left: 1%;
margin-bottom: 24px;
}
中古車販売 まとめ2
結局ブログのYARPPはやめて
車で出したかったので
ステータスをタクソノミーに変更
変更方法は
アドバンスでcar_openに作ったタクソノミーを割り当てる。
返り値はID
IDは順に数値がおおきくなるため、
販売受付中
SOLDOUTと順につくれば
並び順は
ASC となる。
真ん中に新しい項目 交渉中など入れたい場合は
SOLD OUTを一度消して、
作り直す必要が出てくるので
注意
<?php //公開状態
$hoge = get_field('car_open');
if($hoge == '10'):
elseif($hoge == '189'):
?>
という表示方法
IDに変えただけ
ファンクションの
メインクエリは
$meta_query = array(
'relation' => 'AND', //meta_queryの配列が1つの時は指定しない
'meta_sort1' => array(
'key' => 'car_open', //キー
'type' => 'NUMERIC', //タイプ 数字
),
'meta_sort2' => array(
'key' => 'car_cc', //キー
'type' => 'NUMERIC', //値のタイプ 数字
));
$orderby = array(
'meta_sort1' => 'ASC',
'meta_sort2' => 'ASC',
// 'date' => 'DESC'
);
$query->set('meta_query', $meta_query);
$query->set('orderby', $orderby);
結局 ‘meta_sort1’ => ‘ASC’,にへんこうしただけ
yarpp 直書きの場合はタクスとかないとエラーで表示されないからきお
http://blog.k-kansei.com/?p=728
http://www.ex-tra.jp/kosukekato/archives/15420
オプション
yarpp_related(array(
// Pool options: these determine the "pool" of entities which are considered
'post_type' => array('post', 'page', ...),
'show_pass_post' => false, // show password-protected posts
'past_only' => false, // show only posts which were published before the reference post
'exclude' => array(), // a list of term_taxonomy_ids. entities with any of these terms will be excluded from consideration.
'recent' => false, // to limit to entries published recently, set to something like '15 day', '20 week', or '12 month'.
// Relatedness options: these determine how "relatedness" is computed
// Weights are used to construct the "match score" between candidates and the reference post
'weight' => array(
'body' => 1,
'title' => 2, // larger weights mean this criteria will be weighted more heavily
'tax' => array(
'post_tag' => 1,
... // put any taxonomies you want to consider here with their weights
)
),
// Specify taxonomies and a number here to require that a certain number be shared:
'require_tax' => array(
'post_tag' => 1 // for example, this requires all results to have at least one 'post_tag' in common.
),
// The threshold which must be met by the "match score"
'threshold' => 5,
// Display options:
'template' => , // either the name of a file in your active theme or the boolean false to use the builtin template
'limit' => 5, // maximum number of results
'order' => 'score DESC'
),
$reference_ID, // second argument: (optional) the post ID. If not included, it will use the current post.
true); // third argument: (optional) true to echo the HTML block; false to return it
メーカーが更新後トヨタにもどってしまう(何も選択されない)は
その他のアドバンスカスタムで分岐条件でつかっていたからかもしれない
そこをcarにインサートされないようにしたら治った。
中古車販売 まとめ
まず、soldout は今回カスタムフィールドのセレクトボックスで
20 : 販売受付中
1 : SOLD OUT
でやった。
YARPPを使いたい場合は
売り切れを表示する 一覧で最後に表示する
http://www.memo.d-marking.com/blog/2015/10/31/%E5%A3%B2%E3%82%8A%E5%88%87%E3%82%8C%E3%82%92%E8%A1%A8%E7%A4%BA%E3%81%99%E3%82%8B%E3%80%80%E4%B8%80%E8%A6%A7%E3%81%A7%E6%9C%80%E5%BE%8C%E3%81%AB%E8%A1%A8%E7%A4%BA%E3%81%99%E3%82%8B/
を参考に。
soldoutをタクソノミーで作成し、
yarppで 売り切れを除外できる。
並び替え等のファクションのクエリがみなへんこうとなるので注意
車はソートして見る事が基本でカーセンサーとかも関連時事なかったので
今回はなし。
並び替えの際に、たくすクエリで下記とした。
elseif ( $sortset == 'car_pay_money_low' ) { //総支払い価格安い 実際使わない
$meta_query = array(
'relation' => 'AND', //meta_queryの配列が1つの時は指定しない
'meta_sort1' => array(
'key' => 'car_open', //キー
'type' => 'NUMERIC', //値のタイプ 数字
),
'meta_sort2' => array(
'key' => 'car_pay_money', //キー
'type' => 'NUMERIC', //値のタイプ 数字
'value'=>'1', //ask設定
'compare'=>'>=', //総額1以上を表示
));
$orderby = array(
'meta_sort1' => 'DESC',
'meta_sort2' => 'ASC',
// 'date' => 'DESC'
);
$query->set('meta_query', $meta_query);
$query->set('orderby', $orderby);
}
通常の一覧部も
// サーチ ページ数
if ( $query->is_search() && $query->is_main_query() ) {
$query->set('posts_per_page', 12 );
$query->set( 'meta_key', 'car_open' );
$query->set( 'orderby', 'meta_value_num' );
$query->set( 'order', 'DESC' ); //数値が低い順
}
//アーカイブページ数
if ( $query-> is_tax() && $query->is_main_query() ) {
$query->set('posts_per_page', 12 );
$query->set( 'meta_key', 'car_open' );
$query->set( 'orderby',array('meta_value_num' => 'DESC', 'date' => 'DESC') );
}
とした。car_open
ちなみに総額の部分は空欄だとaskでそうすると数値が入ってこないから
ソートで総額の時 最も安いがaskから出るので
上記総額ソートはやめて 車体価格のソートのみに
車体価格を目立たせた
タクソノミーにコメントアウトしてあるから
ファぬションにもうかいてあるので
必要があれば表示すれば並び替わる
タクソノミーは
タクソノミーページで分岐して
まんま 他のタクソノミーを誘導するのをはじめてやった
ギャラリーは
car で ギャラリーで 色々
http://www.memo.d-marking.com/blog/2017/05/11/car-%E3%81%A7%E3%80%80%E3%82%AE%E3%83%A3%E3%83%A9%E3%83%AA%E3%83%BC%E3%81%A7%E3%80%80%E8%89%B2%E3%80%85/
参考
高さをほぼ固定することで決まった。
絞込は
サイドバーでリストカテゴリにて
(タクソノミーを使って カテゴリ1=メーカー カテゴリ2=車両タイプ カテゴリ3=詳細項目として、管理画面から追加並びかえでき、クライアントによっては例えばロードスター専門店の場合 ほぼロードスターなので メーカーを年式 などに カテゴリ2までは自由に変更。詳細項目はシングルにも使ってるので統一 つまり2個のカテゴリは自由に変更
※タクソノミーでやってる場合は 絞り込み検索が自分でできるっぽい。これは後の課題)
http://kotori-blog.com/wordpress/refinement_search/
詳細項目で検索のみ
ドロップダウンで すぐ検索するやつ
<div class="car_serch_title_side" style="margin-top:24px;">
詳細項目で選ぶ
</div>
<div style="padding-top:20px;"></div>
<ul class="car_side_menu">
<?php $cats = get_categories(array(
'post_type' => 'car',
'taxonomy' => 'car_cat3' ,
'hide_empty' => 0 ,//記事がなくとも表示
'depth' => 1,//子は表示しません。
'orderby' => 'order',//順番は指定します
)); ?>
<?php if(!empty($cats)): ?>
<select name="cat" id="cat">
<option value=" "> 詳細項目で選ぶ</option>
<?php foreach($cats as $cat): ?>
<option value="<?php $cat_term = $cat->slug; echo get_term_link($cat_term ,'car_cat3'); ?>"><?php echo $cat->cat_name; ?>(<?php echo $cat->count; ?>)</option>
<?php endforeach; ?>
</select>
<script type="text/javascript">
var dropdown = document.getElementById("cat");
function onCatChange(){
if(dropdown.options[dropdown.selectedIndex].value != ""){
location.href = dropdown.options[dropdown.selectedIndex].value;
}
}
dropdown.onchange = onCatChange;
</script>
<?php endif; ?>
</ul>
お気に入りプラグは ログインしてると、まだありませんが表示されないっぽい。
Duplicate Post は設定画面からカスタムポストも選べるが
カスタムフィールドスイートを使ってると
ループフィールド=今回はギャラリーのサムネイルに使ってるフォーチせずに1個目の画像 が前のものになるようなので
複製しないカスタムフィールドを指定すること
検索boxは
<div class="car_serch_page_side" style="margin-top:30px;">
<div class="car_serch_title_side">
<img src="<?php echo get_stylesheet_directory_uri(); ?>/d/img/car/side_serch.png" width="96" height="25" />
</div>
<div class="search_box">
<form role="search" method="get" id="searchform" action="/" >
<input type="text" value="<?php the_search_query(); ?>" name="s" class="s" />
<input type="hidden" name="post_type" value="car">
<input type="submit" class="searchsubmit" value="" />
</form>
</div>
</div>
とした。
value="<?php the_search_query(); ?>"
とすると、検索後も検索ワードが検索ボックスに入ったままになる
is_main_query で meta_query を使う
複数 meta_key の指定
http://qiita.com/harapeko_wktk/items/4fe7d39ad22d3951e5cc
elseif ( $sortset == 'car_price_high' ) { //価格高い
$meta_query = array(
'relation' => 'AND', //meta_queryの配列が1つの時は指定しない
'meta_sort_parent_id' => array(
'key' => 'car_open', //カスタムフィールドのキー
'type' => 'NUMERIC', //カスタムフィールドの値のタイプ
),
'meta_sort_child_id' => array(
'key' => 'car_price', //カスタムフィールドのキー
'type' => 'NUMERIC', //カスタムフィールドの値のタイプ
)
);
$orderby = array(
'meta_sort_parent_id' => 'DESC',
'meta_sort_child_id' => 'DESC',
// 'date' => 'DESC'
);
$query->set('meta_query', $meta_query);
$query->set('orderby', $orderby);
}
だがけっきょく、 使わない買った
いや使った
結局、価格でソートなど
その前に売り切れで分岐したい場合
2個使いました。