フォーラムへの返信

4件の返信を表示中 - 1 - 4件目 (全4件中)
  • トピック投稿者 piiyann

    (@piiyann)

    Category Order and Taxonomy Terms Orderを使うと管理画面も順番が変更できました。
    自己解決とさせて頂きます。
    お騒がせしました。

    トピック投稿者 piiyann

    (@piiyann)

    jim912さんご指摘ありがとうございます。

    カテゴリー
    親カテゴリー(非表示)
    ー子カテゴリーA(表示)
    ーー孫カテゴリーB(表示)
    ーーーひ孫カテゴリーC(表示)
    ー子カテゴリー(表示)D
    ーー孫カテゴリー(表示)E
    ーーーひ孫カテゴリー(表示)F

    表示させたいイメージ
    子カテゴリ / 孫カテゴリー / ひ孫カテゴリー

    現状
    親カテゴリー / 子カテゴリ /孫カテゴリー / ひ孫カテゴリー

    カテゴリーアーカイブページと記事ページで
    親子順でカテゴリーを表示させたいのですが、
    尚且つ一番上の親カテゴリー除いた形で表示したいです。

    トピック投稿者 piiyann

    (@piiyann)

    もっといいやり方があるかと思いますが、無事にできました。

    <?php if ( have_posts() ) : query_posts('showposts=1&cat=377'); ?>
    <?php while (have_posts()) : the_post(); ?>
    最新記事(親カテゴリ)
                            <?php if (in_category('380')) : ?>
                            <?php
                            	$deve = "380";
    						;?>
                            <?php endif; ?>
                            <?php if (in_category('381')) : ?>
                            <?php
                            	$deve = "381";
    						;?>
                            <?php endif; ?>
                            <?php if (in_category('382')) : ?>
                            <?php
                            	$deve = "382";
    						;?>
                            <?php endif; ?>
    					</div>
    				</div>
    <?php endwhile;?>
    <?php endif; ?>
    <?php query_posts($query_string); ?>
    <?php if ($deve == 380): ?>
    <?php if ( have_posts() ) : query_posts('showposts=1&cat=380&offset=1'); ?>
    <?php while (have_posts()) : the_post(); ?>
    子カテゴリーA
    <?php endwhile;?>
    <?php endif; ?>
    <?php endif; ?>
    <?php query_posts($query_string); ?>
    <?php if ($deve == 381): ?>
    <?php if ( have_posts() ) : query_posts('showposts=1&cat=381&offset=1'); ?>
    <?php while (have_posts()) : the_post(); ?>
    子カテゴリーB
    <?php endwhile;?>
    <?php endif; ?>
    <?php else : ?>
    <?php if ( have_posts() ) : query_posts('showposts=1&cat=381'); ?>
    <?php while (have_posts()) : the_post(); ?>
    子カテゴリーB
    <?php endwhile;?>
    <?php endif; ?>
    <?php endif; ?>
    <?php query_posts($query_string); ?>
    <?php if ($deve == 382): ?>
    <?php if ( have_posts() ) : query_posts('showposts=1&cat=382&offset=1'); ?>
    <?php while (have_posts()) : the_post(); ?>
    子カテゴリーC
    <?php endwhile;?>
    <?php endif; ?>
    <?php else : ?>
    <?php if ( have_posts() ) : query_posts('showposts=1&cat=382'); ?>
    <?php while (have_posts()) : the_post(); ?>
    子カテゴリーC
    <?php endwhile;?>
    <?php endif; ?>
    <?php endif; ?>
    トピック投稿者 piiyann

    (@piiyann)

    このようなコードをあるカテゴリーページで作りました。
    最新記事に入った記事のカテゴリーからは最新ではなく2件目を表示させたいです。

    <?php if ( have_posts() ) : query_posts('showposts=1&cat=377'); ?>
    <?php while (have_posts()) : the_post(); ?>
    最新記事(親カテゴリ)
    <?php endwhile;?>
    <?php endif; ?>
    <?php if ( have_posts() ) : query_posts('showposts=1&cat=380'); ?>
    <?php while (have_posts()) : the_post(); ?>
    子カテゴリーA
    <?php endwhile;?>
    <?php endif; ?>
    <?php if ( have_posts() ) : query_posts('showposts=1&cat=381'); ?>
    <?php while (have_posts()) : the_post(); ?>
    子カテゴリーB
    <?php endwhile;?>
    <?php endif; ?>
    <?php if ( have_posts() ) : query_posts('showposts=1&cat=382'); ?>
    <?php while (have_posts()) : the_post(); ?>
    子カテゴリーC
    <?php endwhile;?>
    <?php endif; ?>
4件の返信を表示中 - 1 - 4件目 (全4件中)