26
November
[PR]
×
[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。
[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。
add_filter( 'usces_filter_item_list_loopimg', 'my_filter_searchpage', 10, 2);
function my_filter_searchpage($html, $content){
global $post , $usces;
$html = '<div class="mysearch_box"><a href="' . get_permalink($post->ID) . '">' . usces_the_itemImage(0, 150, 150, $post, 'return');
$html .= '<div class="mysearch_title">' . usces_the_itemName( 'return' ) . '</div></a>';
if (usces_the_itemZaiko('return') == '売切れ'){
$html .= '<div class="price">';
$html .= usces_the_itemZaiko('return') . '</div>';
}else{
if (usces_the_firstCprice('return') > 0) {
$html .= '<div class="reg_price">';
if( function_exists('usces_crform') ){
$html .= usces_crform( usces_the_firstCprice('return'), true, false, 'return' );
}else{
$html .= __('$', 'usces') . number_format(usces_the_firstCprice('return'));
}
$html .= $usces->getGuidTax() . '</div>';
}
$html .= '<div class="price">' . usces_crform( usces_the_firstPrice('return'), true, false , 'return' );
$html .= $usces->getGuidTax() . '</div>' . '</div>';
}
return $html;}
これを丸ごとコピペして改変していってなんとかできた。
しかしここに抜粋のせたいとか色々やろうとしたけど、全然うまくいかないのであきらめた。
/*
アーカイブページで現在のカテゴリー・タグ・タームを取得する
*/
function get_current_term(){
$id;
$tax_slug;
if(is_category()){
$tax_slug = "category";
$id = get_query_var('cat');
}else if(is_tag()){
$tax_slug = "post_tag";
$id = get_query_var('tag_id');
}else if(is_tax()){
$tax_slug = get_query_var('taxonomy');
$term_slug = get_query_var('term');
$term = get_term_by("slug",$term_slug,$tax_slug);
$id = $term->term_id;
}
return get_term($id,$tax_slug);
}
//カテゴリ・タグ・カスタムタクソノミー オブジェクトを取得
$term = get_current_term();
//以下は必要に応じて記述
echo $term->name; //名前を表示
echo $term->slug; //スラッグを表示
echo $term->description; //説明文を表示
echo $term->count; //投稿数を表示
例)現在のカテゴリー名を取得
<p>
<?php $term = get_current_term(); ?>
<?php echo $term->name; ?>
</p>
カテゴリ名を取得しようと調べたら、1行で終わらないのばかりで面倒っておもった。
そしたらまとめてくれている人がいたので、こんどからコレを利用しようとおもう。
function the_category_filter($thelist,$separator=', ') {
if(!defined('WP_ADMIN')) {
$exclude = array('カテゴリー名','カテゴリー名','カテゴリー名');
$cats = explode($separator,$thelist);
$newlist = array();
foreach($cats as $cat) {
$catname = trim(strip_tags($cat));
if(!in_array($catname,$exclude))
$newlist[] = $cat;
}
return implode($separator,$newlist);
} else
return $thelist;
}
add_filter('the_category','the_category_filter',10,2);