More Related Content
Similar to 落とし穴に落ちないためのWordPress基礎知識 (20)
落とし穴に落ちないためのWordPress基礎知識
- 9. © wordbonch.org
落とし穴 その1
8
<?php get_header(); ?>
<main id=" main" class="site-main">
<?php if ( is_home() &&! is_front_page()) : ?>
<header>
<h1 class="page-title screen-reader-text"><?php single_post_title(); ?></h1>
</header >
<?php endif; ?>
<?php
// るーぷ
while( have_posts()) : the_post();
get_template_part( 'content', get_post_format() );
endwhile ; endif; ?>
</main >
<?php get_footer(); ?>
• インデントが揃っていない
• コメントが適当
• すべての行がくっついている
- 13. © wordbonch.org
落とし穴 その1
12
WordPressコーディング規約の例
• インデントはタブで、縦位置の調整はスペースで行う。
• インデントの位置はきちんと合わせる。
<?php if ( is_home() && ! is_front_page() ) : ?>
[ tab ]<header>
[ tab ] [ tab ]<h1 class="page-title screen-reader-text"><?php single_post_title(); ?></h1>
[ tab ]</header>
<?php endif; ?>
- 35. © wordbonch.org
WordPressテーマを新規作成
34
該当ページ 優先度
TOPページ
index.php
home.php
月別ページ
archive.php
date.php
カテゴリーページ category.php category-id.php category-slug.php
タグページ tag.php tag-id.php tag-slug.php
タクソノミーページ taxonomy.php taxonomy-tax.php taxonomy-tax-term.php
投稿タイプページ archive-posttype.php
ユーザーページ author.php author-id.php author-nicename.php
メディアページ
single.php
attachment.php MIME_type.php
記事ページ single-posttype.php
固定ページ page.php page-id.php page-slug.php custom.php
検索結果ページ search.php
404ページ 404.php
低 高
第3回 WordPressテーマ作成 (p.17〜18)参照
https://www.slideshare.net/miiitaka/word-press-32692859