index.php 745 B

1234567891011121314151617181920212223
  1. <?php
  2. /**
  3. * The main template file
  4. * This is the most generic template file in a WordPress theme
  5. * and one of the two required files for a theme (the other being style.css).
  6. * It is used to display a page when nothing more specific matches a query.
  7. * E.g., it puts together the home page when no home.php file exists
  8. *
  9. * Methods for TimberHelper can be found in the /lib sub-directory
  10. *
  11. * @package WordPress
  12. * @subpackage Timber
  13. * @since Timber 0.1
  14. */
  15. $context = Timber::context();
  16. $context['posts'] = new Timber\PostQuery();
  17. $context['foo'] = 'bar';
  18. $templates = array( 'index.twig' );
  19. if ( is_home() ) {
  20. array_unshift( $templates, 'front-page.twig', 'home.twig' );
  21. }
  22. Timber::render( $templates, $context );