Routing

index.php file in theme’s root serves as a router to all the theme views.

index.php
21
22
23
24
25
26
27
28
29
if (is_single()) {
  render_template("templates/single");
} else if (is_front_page()){
  render_static("templates/static");
}else if (is_archive()) {
  render_template("templates/archive");
} else {
  render_template("templates/404");
}

As you can see, you first determine the type of the page using WordPress conditional tags, and then delegate the rendering to an individual view.

While index.php is the entry point of any WordPress theme, as it is called/required by it, the render_template() function is where we connect WordPress core with Wordless’ powerups.

The next chapter is all about rendering.

See also

Using Page Template Wordpress’ feature inside Wordless

Todo

Page Template Wordpress’ feature has to be updated on GitHub in order to reflect new PUG templating practices