Developer Snippet Diary

Wordpress intro, Post types, file structure, and template Hierarchy

1. Post types:
Stored in table wp_posts and column post_type in database

  1. Post (Post Type: ‘post’)
    used for blogs mostly, {single, single-post, category, tag, taxonomy, archive, author, date.php, search,home,index}.php template files used by post.
  2. Page (Post Type: ‘page’)
    {page, $custom, front-page, search, index}.php templates used
  3. Attachment (Post Type: ‘attachment’)
    {MIME_type.php, attachment.php, single-attachment.php, single.php ,index.php}
  4. Revision (Post Type: ‘revision’);

  5. 5.Navigation menu (Post Type: ‘nav_menu_item’)

2. Recommended File Structure

 

wp-content> themes > mythme
  > assets (dir)
  > css (dir)
  > images (dir)
  > js (dir)
  > inc (dir)
  > template-parts (dir)
  404.php
  footer.php
  functions.php
  header.php
  index.php
  page.php
  screenshot.png
  sidebar.php
  single.php
  style.css

3. Template Hirerarchy (how WordPress determines which template file(s) to use on individual pages)

Posted by: R GONDAL
Email: rizikmw@gmail.com