//未使用目もこーど//タクソノミ選択とカスタムフィールドのラジオボタンをシンクロさせる //http://yahss.net/wordpress/1302-synchronize-tax-with-customfield/ function my_print_footer_scripts() { global $post_type; if ($post_type == 'estate'): ?> <script type="text/javascript"> //<![CDATA[ jQuery(function($){ // タクソノミ選択チェックボックスをラジオボタンに $(".categorychecklist input[type=checkbox]").each(function(){ $(this).attr("type","radio"); }); // タクソノミIDとタクソノミ名を配列に定義 var tax_arr = new Array(); tax_arr['#in-tax_estate-6'] = '売買物件'; tax_arr['#in-tax_estate-7'] = '賃貸物件'; // タクソノミクリック時の処理 $("input[name^=tax_input]").live("click", function(){ $("input[name^=tax_input]").each(function(){ if ( $(this).is(':checked') == true ) { taxid = $(this).val(); taxname = tax_arr['#in-tax_estate-'+taxid]; return false; } }); $("#acf-field-sellrent-"+taxname).attr('checked', 'checked'); }); // カスタムフィールドのラジオボタンクリック時の処理 $("[id^=acf-field-sellrent-]").live("click", function(){ $("[id^=acf-field-sellrent-]").each(function(){ if ( $(this).is(':checked') == true ) { taxname = $(this).val(); return false; } }); for (var key in tax_arr) { if ( tax_arr[key] == taxname ) taxid = key; } $(taxid).attr('checked', 'checked'); }); }); //]]> </script> <?php endif; } add_action('admin_print_footer_scripts', 'my_print_footer_scripts', 21);
投稿者: doggstar
商品 車販売 ブログ と検索と結果のページを分ける方法
ここ参考
まず車はポストタイプカー
<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> <?php //if(function_exists('wp_custom_fields_search')) wp_custom_fields_search(); ?> </div>
welcartは商品カテゴリ内 ポストタイプポスト
<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="post"> <input type="hidden" name="cat" id="cat" value="287" /> <input type="submit" class="searchsubmit" value="" /> </form> </div> <?php //if(function_exists('wp_custom_fields_search')) wp_custom_fields_search(); ?> </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="post"> <input type="hidden" name="cat" id="cat" value="-287" /> <input type="submit" class="searchsubmit" value="" /> </form> </div> <?php //if(function_exists('wp_custom_fields_search')) wp_custom_fields_search(); ?> </div>
検索結果は
ポストタイプごとに分けれるらしい
earch-投稿タイプ名.php” というテンプレートが使えるようになります。
add_filter('template_include','custom_search_template'); function custom_search_template($template){ if ( is_search() ){ $post_types = get_query_var('post_type'); foreach ( (array) $post_types as $post_type ) $templates[] = "search-{$post_type}.php"; $templates[] = 'search.php'; $template = get_query_template('search',$templates); } return $template; }
ブログ結果添付内で
商品ならで違うフォームにとばしてリターンさせてブログはわけれそう
但し、車のファンクションで
is serch でメインクエリかけてる部分があるので
それを入れてるとブログの検索結果が除外されてしまうので
そこは検証
// サーチ ページ数 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', 'ASC' ); //数値が低い順 }
これが問題なようだ
// サーチ ページ数 if ( $query->is_search() && $query->is_main_query() ) { $sortset = (string)filter_input(INPUT_POST, 'post'); if ($sortset == 'car' ){ $query->set('posts_per_page', 12 ); $query->set( 'meta_key', 'car_open' ); $query->set( 'orderby', 'meta_value_num' ); $query->set( 'order', 'ASC' ); //数値が低い順 } }
としてpostがカーのときのみこれが効く様にした。
どうやらINPUT_POSTでなく INPUT_GETなようだ
xhtmlからhtml5に変えた時のline-hightの仕様
div内にspanでフォントサイズ調整したものは
いままでline-hightがそのサイズのline-hightをもっていたが
html5に変えると
親のdivの持っているフォントサイズのline-hightをもつことになる。
そのため
divでくくってやるとよい
body 1.55 単位なしで指定
若干 メニューやリストの高さも違う?
後日調べた結果
http://gakublog.com/archives/667
まず
img { vertical-align: bottom; }
メニューのリスト等のサイズが変わる問題
これはアイコンフォントにフォントサイズが指定してあるから、
いままではアイコンフォントがはみ出していても無視されたが
今回は無視されない?
アイコンフォントを disoplay インラインblock にしてやるとよい ではなく
フォントサイズを指定しないか 100%にしてやること
あと FBのボタンがずれるので
.fb_iframe_widget > span { vertical-align: baseline !important; }
ローカル MAMP SSL https 複数 独自ドメイン
https://qiita.com/maximum80/items/c8756f65662d009cc52d
ここの参考
ここを見る
/Applications/MAMP/conf/apacheに直製造した。
server.key
server.key.bak
server.crt
server.csr
cd /Applications/MAMP/conf/apache/keys × cd /Applications/MAMP/conf/apache/ 1 openssl genrsa -des3 -out server.key 1024 openssl req -new -key server.key -out server.csr Country Name (2 letter code) [AU]:JP State or Province Name (full name) [Some-State]:Aichi Locality Name (eg, city) []:Kasugai-shi Organization Name (eg, company) [Internet Widgits Pty Ltd]:D-MarkingDesign Organizational Unit Name (eg, section) []: Common Name (e.g. server FQDN or YOUR name) []:localhost Email Address []:info@d-marking.jp openssl x509 -in server.csr -days 55365 -req -signkey server.key > server.crt
MAMP/conf/apache/httpd.conf
# Secure (SSL/TLS) connections #Include /Applications/MAMP/conf/apache/extra/httpd-ssl.conf
# Secure (SSL/TLS) connections Include /Applications/MAMP/conf/apache/extra/httpd-ssl.conf
MAMP/conf/apache/extra/httpd-ssl.conf
<VirtualHost _default_:443> # General setup for the virtual host DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/Dropbox/my_server/" ServerName www.example.com:443 ServerAdmin info@d-marking.jp ErrorLog "/Applications/MAMP/Library/logs/error_log" TransferLog "/Applications/MAMP/Library/logs/access_log" ・ ・ ・
MAMP/conf/apache/extra/httpd-vhosts.conf
NameVirtualHost *:80 NameVirtualHost *:443
<VirtualHost *:80> ServerAdmin info@d-marking.jp DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs" ServerName localhost </VirtualHost> <VirtualHost *:80> ServerAdmin info@d-marking.jp DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs" ServerName www.example.com </VirtualHost>
これでローカルとwww.example.comはhttpsでつながった
問題はここからハマった
その下に
80はすでに書いてあるとして
<VirtualHost *:443> DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/Dropbox/my_server/client/kanrikoushin/mama-clean.com" ServerName mama-clean.com:443 ServerAdmin info@d-marking.jp SSLEngine on SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL SSLCertificateFile "/Applications/MAMP/conf/apache/server.crt" SSLCertificateKeyFile "/Applications/MAMP/conf/apache/server.key" </VirtualHost> <VirtualHost *:443> DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/Dropbox/my_server/doggstar/temp/shop" ServerName www.shop.d-marking.jp:443 ServerAdmin info@d-marking.jp SSLEngine on SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL SSLCertificateFile "/Applications/MAMP/conf/apache/server.crt" SSLCertificateKeyFile "/Applications/MAMP/conf/apache/server.key" </VirtualHost> <VirtualHost *:443> DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/Dropbox/my_server/doggstar/temp/car" ServerName www.car.d-marking.jp:443 ServerAdmin info@d-marking.jp SSLEngine on SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL SSLCertificateFile "/Applications/MAMP/conf/apache/server.crt" SSLCertificateKeyFile "/Applications/MAMP/conf/apache/server.key" </VirtualHost>
これはできた時のコピペだが
テキストエディットのせいか
一回ではNOT FOUND になってしまう。
その場合
もう一度動いている443を1個コピペして
動かしたい
443から必要項目をコピペして
MAMPを再起動したら動いた
つまりは 通常の80番のときとおなじようなよくわからない動かないって言うエラー
これでローカルでSSLで作業できる。
テキストエディタ miで開いてコピペしたら一発でできた
https://qiita.com/nao_ipub/items/e7adf6043e7f9189a738
ローカルで毎回この接続ではプライバシーが保護されませんが出るので
localhost.cerをドロップしてDLして
ダブルクリック
「自己署名ルート証明書」とかになってる場合は、キーチェーンアクセスの該当行をダブルクリックして情報を確認。「信頼」タブを開き、「この証明書を使用するとき」を「常に信頼」にします。
(追記:「SSL(Secure Sockets Layer)」の行だけを「常に信頼」で大丈夫です。他にもメールや諸々使ってる時は適宜変更します。)
Shop 追加手順 welcart
welcartを入れる D/d_parts/welcart をコピーして入れる f4_int.less(中心less) に @import "../d_parts/welcart/welcart.less"; @import "../4_custom/welcart/welcart.less"; // welcart 追加 welcart_funcに $welcart_cat= 287; $welcart_cat_out= -287; の商品カテゴリにのIDを記載 //除外したいカテゴリIDを入れる if ( ! in_array( $parent->term_id, array( 287,290 ) ) ) を変更 // テキストエディタにクイックタグボタンを追加 もここで変更する シンプルカスタムフィールドで 商品詳細フィールドを作成 商品詳細 WYSIWYG item_info 投稿 ブログトップ 記事すべて読む part_blog_top.php に商品を表示させないコードを追加 //ブログトップ <?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); //part_blog_top.php <?php $args = array( 'posts_per_page' => 6, 'post_type' => 'post', //カスタム投稿名 'cat' => $info_cat_out.','.$welcart_cat_out, ) ?> ブログサイドバーにカテゴリを使うなら blog_side_menu.phpに 'exclude_tree' => $welcart_cat_out,//welcartの商品ID を追加 アーカーイブに <?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;?> を入れてリターンさせる カスタムアドミンでいらないものを隠す 使いやすくする custom-admin-css.css /*welcart 商品詳細入力の横タイトル消す*/ .smart-cf-meta-box th{display: none;} /*商品詳細本文欄*/ .welcart-shop_page_usces_itemedit #wp-content-wrap ,.welcart-shop_page_usces_itemedit #postdivrich /*商品詳細本文文字 これで効く不明*/ ,div.inside div.itempagetitle:nth-of-type(3) /*商品オプション*/ ,#itemoption ,.welcart-shop_page_usces_itemedit #cftdiv ,.welcart-shop_page_usces_itemedit #cfs_input_991 ,.welcart-shop_page_usces_itemedit #tagsdiv-post_tag ,.welcart-shop_page_usces_itemedit #postimagediv ,.welcart-shop_page_usces_itemedit #commentsdiv ,.welcart-shop_page_usces_itemedit #yarpp_relatedposts {display: none;} /*SKU追加ボタンを忘れがちだから赤化*/ #newskusubmit input{ background: #e14d43; border-color: #d02c21; color: #fff; -webkit-box-shadow: inset 0 1px 0 #ec8b85,0 1px 0 rgba(0,0,0,.15); box-shadow: inset 0 1px 0 #ec8b85,0 1px 0 rgba(0,0,0,.15); margin-bottom:15px;} /*編集画面がちいさいから スマート*/ #smart_custom_fields_item_info__0__ifr{min-height: 600px;} エディター画面にテーブルcssを対応させる editor-style.css /*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
地域 まとめ
ファンク 地域 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' ); サイドバーのリスト表示 css 親子だとliでおかしな表示になるのでliで表示さあせない そのため a で表示 css con .service_chiiki{ a{display: inline-block;} a:after{content:",\00A0";} overflow: hidden; //li{float: left;} //li a:after{content:",\00A0";} } 親子無視リストなし <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> ブログサイドバー用 分岐+ ドロップダウン 買取地域は 別にタクソノミー(ブログ買取地域はblog_chiiki として サービス地域と全く同じものを入れる ) WP Taxonomy Import 設定からインポートすると楽 //ブログサイドバー blog_side_menu.php //ドロップダウン地域 blog_side_menu_chiiki.php シングル追加 カテゴリに地域 roop.php <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> タクソノミーに追加 <?php elseif(is_tax('blog_chiiki')):?> <?php include( get_stylesheet_directory() . '/archive.php'); ?> <?php endif; ?> アーカイブに追加 archive.php <h2 class="h2_class"> BLOG <? if(is_tag()):?>タグ:<? elseif(is_tax('blog_chiiki')):?>古本出張買取実績:<? else:?> カテゴリ:<? endif;?><?php single_term_title(); ?> </h2> カテゴリの説明と画像を取得してservice_chiiki にひょうじさせる アドバンスカスタムフィールど使用 cat_img 画像ID 説明はそのままディスプリクション さらにブログカテゴリーにその同じ名前の記事があればリンクを表示させる <!--個--> <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();//------------ブログあれば出す ?>
Shop 制作時追加
シンプルカスタムで コンテンツを追加 出力 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
河島 製作時 追加
.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;} }