rtCamp notes, day 32 of undefined

Some functions I explored today, the parameter is not a valid parameter, but it is just for understanding of me to see what parameters it can accept.

is_home();
 is_single( array( 1, 'Post title', 'Post slug' ) );
 is_singular( array( 'post-type', 'post-type' ) )
 is_page_template();
 is_sticky( 'Post_ID' );
 post_type_exists( 'post_type' );
 get_post_type( 'POST ID or POST OBJECT' );
is_post_type_hierarchical( 'post-type' );
is_post_type_archive( 'post-type or [post-type]' );
comments_open( $post_id:integer|WP_Post|null );
is_category( array( 9, '‘blue-cheese’',' ‘Stinky Cheeses’' ) );
is_tag( array( 1, 'Tag name', 'tag slug' ) )
 has_tag( array( 1, 'Tag name', 'tag slug' ), $post  );
is_tax( $taxonomy:string|array, $term:integer|string|array|array )

is_TAX only works for custom taxonomies not for category or tag

has_term( array( 'termid', 'slug', 'name' ) , 'taxonomy' , 'POST_ID or )BJECT' )
is_author( array( 4, 'nice name', 'nick name' ) );
is_home();
is_attachment($attachment:integer|string|array|array )
is_preview();

Revision: Hierarchy

Front Page

  • front-page.php

if front page is a static page -> move to the Page hierarchy from here.
else,

  • home.php
  • index.php

Single Post Type (except page)

  • Attachment Post Type
    – {mimetype}-{subtype}.php -> image-jpeg.php
    – image.php
    – attachment.php
    – will go to Custom Post
  • Custom Post
    – single-{posttype}-{post_slug}.php
    – single-{posttype}.php
  • Blog Post
    – single-post.php


After the following behaviour, it will fallback to

  • single.php
  • singular.php
  • index.php

Page

  • { Post Template }
  • page-{slug}.php
  • page-{id}.php
  • page.php
  • singular.php
  • index.php

Blog posts

  • home.php
  • index.php

Error page

  • 404.php
  • index.php

Search

  • search.php
  • index.php

Archives

  • Author Archive
    – author-{nicename}.php
    – author-{id}.php
    – author.php
    – archive.php
    – index.php
  • Category Archive
    – category-{slug}.php
    – category-{id}.php
    – category.php
    – archive.php
    – index.php
  • Custom Post Type archive
    – archive-{posttype}.php
    – archive.php
    – index.php
  • Custom Taxonomy Archive
    – taxonomy-{taxonomy}-{term}.php
    – taxonomy-{taxonomy}.php
    – taxonomy.php
    – archive.php
    – index.php
  • Date archive

Leave a Reply

Your email address will not be published. Required fields are marked *