Re: [解決済み] キーワード検索の結果ページのカスタマイズ
フォーラム › テンプレート(テーマ) › [解決済み] キーワード検索の結果ページのカスタマイズ › Re: [解決済み] キーワード検索の結果ページのカスタマイズ
2011年9月21日 1:09 AM
#62893
nanbu
キーマスター
こんにちは。
キーワード検索の結果は商品以外の記事も対象になります。Welcart は商品だった場合のみレイアウトを強制的に変更しています。それを行なっているファイルは、usc-e-shop/templates/wp_search_item.php です。
見て頂くと分かると思いますが、フックがありますのでレイアウトを自由に変更できます。このフックを使ったフィルターの例は次の通りです。
add_filter( 'usces_filter_item_list_loopimg', 'my_filter_item_list_loopimg', 10, 2);
function my_filter_item_list_loopimg($html, $content){
global $post;
$html = '<div>' . usces_the_itemName( 'return' ) . '</div>';
$html .= '<div class="loopimg"><a href="' . get_permalink($post->ID) . '">' . usces_the_itemImage(0, 100, 100, $post, 'return') . '</a></div>';
$html .= '<div class="loopexp"><div class="field">' . $content . '</div></div>';
return $html;
}
フィルターの設置の仕方はこちらをご覧下さい。
https://www.welcart.com/community/archives/1697
なお、残念ながらキーワード検索の結果は「Item List Layout」では処理できません。よろしくお願いいたします。