As a WordPress developer, You should know to create custom theme & custom plugin. Here the first tutorial about how to create custom theme in WordPress.
6 main files are needed into your custom theme folder.
- index.php
- style.php
- screenshot.png (1200 by 900) of size
- single.php which is responsible for individual post layout
- page.php which is responsible for individual page layout
- functions.php which is responsible to add elements & functionality to theme. Later one we will add,
- front-page.php – This is the front page layout which is going to be set as homepage in WordPress settings.
- archive.php – This is responsible to set layouts for Author archive, Date archive & Category archive.
Later on we will add more files into custom theme folder.
Now into your index.php use wp functions, get_header() and get_footer() which loads header.php & footer.php respectively.
Now in your header.php use function wp_head() – This is used in header.php & which loads all script data and head tags into each page/post
Same as in footer.php add wp_footer() – this is used in footer.php & which loads JS for each page.
Please note we are using various plugins and each plugins adds CSS & JS to either in header or footer so these both functions take responsibility to add those JS & CSS to respected places.
At this stage remember some of wp functions.
bloginfo() | Display information about current site |
have_posts() | This is the variable we pass in while loop to go through all posts into loop |
the_post() | To select one single post to work with in the loop |
the_title() | get the title of the post |
the_content() | get the content of the post |
the_permalink() | get the url of the post |
get_theme_file_uri() | get the theme file location in /../../../ format |