You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
説明 2日にわたって投稿した「query_posts(WP_Queryクラス)でカテゴリーを絞り込む」「query_posts(WP_Queryクラス)で投稿タグを絞り込む」の続き。今日はカテゴリーや投稿タグ以外ののタクソノミーによる絞り込み、複数のタクソノミーの絞り込みの組み合わせについてまとめてみる。 そもそも一連の投稿のきっかけになったのは、新テーマ「Twenty Eleven」の短冊ウィジェットがきっかけだった。その部分はこちら。 'tax_query' => array( array( 'taxonomy' => 'post_format', 'terms' => array( 'post-format-aside', 'post-format-link', 'post-format-status', 'post-format-quote' ), 'field' => 'slug
こんにちは。 query_postを使用してカテゴリーとタクソノミーをアンド検索した結果を表示する、 検索画面を作っています。 たとえば カテゴリー:Japanese タクソノミーArea:City で検索した場合、 URLを http://******/category/japanese/?Area=city として、カテゴリーアーカイブのURLにAreaのタクソノミーを付加し $arg_page = get_query_var('paged' ); $arg_cat = get_query_var( 'cat' ); $arg_area = $_GET['Area']; query_posts( array( 'paged'=>$arg_page, 'area'=>$arg_area, 'cat'=>$arg_cat, 'posts_per_page' => 10, 'order' =
WordPress3.0から追加されたカスタム投稿タイプ、カスタムタクソノミ(カスタム分類)も、バージョンが上がるごとに少しづつではありますが使いやすくなってきました。 それでも今回、カスタムタクソノミを複数指定した状態でその内容を表示する記述にかなり悩んだので、メモしておきます。 動作確認環境 WordPress3.2.1(古いバージョンだと動作しない可能性があります) 説明 ポイントは「tax_query」という項目。WordPress3.1から導入されたものらしいです。 ポストタイプ名、紐付けされたカスタムタクソノミ名を指定した上で、指定したいタクソノミのスラッグを記述すると、記事内容を複数から取得します。 コード <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array(
CMS的なサイトを制作中です。 商品(items)というカスタム投稿タイプに、「区分(classifications)」と 「特売日(sale_date)」という2つのカスタム分類を割り当てています。 パーマリンクは /%category%/%page_id%.html と指定。 カスタム投稿タイプ、カスタム分類ともにCustom Post Types UIで設定。 「classifications」は2階層。 □現状は以下の通りです。 A)sale_dateのterm 20100823をもつ商品の一覧を表示する際に、 http://localhost/sale_date/20100823/ というURLで一覧が表示されます。 (テンプレートはtaxonomy-sale_date.phpを作成、使用) B)classificationsのterm ABCをもつ商品の一覧を表示する際に、 h
先日、「WordPress 3.1 RC3 をみんなでテスト! 」に参加し、その際、複数カスタムタクソノミークエリー(en. Multiple Taxonomy Handling)のテストを担当させてもらいました。 ついでに、仕様などについても探ってましたので、まとめてみることにします。 複数タクソノミークエリーとは なるべく正確に言うと、query_posts または get_posts の引数に新たに設けられた tax_query により、カテゴリー、タグ、カスタムタクソノミー等による記事抽出条件を、複数かつ様々なパラメータで細かく設定できる機能。 tax_query の値は、抽出条件毎の配列と各条件の結合方法(パラメータ名:relation)で構成される。 こう書いても、分かりにくいと思いますので、もっとかみ砕いて、粉状にして言うと「これさえ憶えておけば、WordPressでの絞り込
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く