WordPressに関する情報や技術紹介です

To change the design for each category

If you want to change the design in each category, discovered that only by changing the file name can be realized. I tried to try.

create a category-XX.php file

Where XX is the input of the category ID (for example: category-2.php). If you want to apply the same design in all categories,
"Category.php"
Assuming good.
Priority category-XX.php> category.php way

Achieved in the following way.

  1. Check the ID of the category you want to change from → "category" "Administration" in the admin area.
  2. Changed to "category-6.php" in the folder the "index.php". ※ In this blog hit the News category.
  3. Change the file in a suitable, make sure to upload to the server.

Well, too easy. WordPress is an excellent tool might fairly.
Besides, if you introduce a Themed Categories Plugin, or likely to be selected from the management screen.

The problem of an individual article page is only one.
When I moved to the current situation and an individual article, "index.php" would have been applied.

Tentatively, the following is that we created this category-6.php. No different from "index.php" because most tests.

<?php get_header(); ?>
<div id="body">
<div id="contents"><div id="content">
	<p>これはお知らせカテゴリのページです。</p> ←ここだけ変更
<!-- 最新記事のループ表示 -->
	<div class="post">
		<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
			<h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
			<?php the_content() ?>
			記事のリンク先URL:<?php the_permalink() ?>
		<?php endwhile; else: ?>
			<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
		<?php endif; ?>
		<div class="pagelink"><?php posts_nav_link(' | ', '前のページ', '次のページ'); ?></div>
	</div>
<!-- 最新記事の表示 -->
</div><!-- content-end --></div><!-- contents-end -->
<?php get_sidebar(); ?>
</div><!-- body-end -->
<?php get_footer(); ?>
タグ
, ,
トラックバックURL

Leave a Reply

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

*

次のHTML タグと属性が使えます: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

ページTOPに戻る