ポストタイプはシングルを使っている
カテゴリはitemが作成され(カテゴリーに)
その子カテゴリでカテゴリー分けする
ブログと混合するので
シングルは シングル内で分岐する
1 | <?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
1 2 3 4 5 | <?php
if ( in_category( 'item' ) ||
post_is_in_descendant_category( get_term_by( 'slug' , 'item' , 'category' ))):
?>
|
管理画面 商品マスターで商品を管理するが
カスタムフィールドを追加したい場合
ブログ投稿にも、カスタムフィールドが表示される
それを回避するために、ブログ投稿画面で表示で表示させ
カスタムフィールドをcssでい表示にさせ、商品ページのみひょうじさせる。
例はシンプルカスタムフィールド
カスタムフィールドスイートはコピーすると変になるらしい
アドバンスはどうか?
1 2 3 4 5 6 7 8 | #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種類しかないので
フルサイズか 近いサイズ だろう なのでそのサイズの画像を用意しておかないと
フルサイズを取得しないといけないので重くなる
1 | <?php usces_the_itemImage( 0, 100, 100 ); ?>
|
1 | <a href= "<?php usces_the_itemImageURL(0); ?>" ><?php usces_the_itemImage(); ?></a>
|
https://www.welcart.com/documents/archives/673
1 | <?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
コレをファンクションに追加
1 2 3 4 5 6 7 8 | 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 ;
}
|