Example #1
0
 /**
  * Get context.
  *
  * @return array
  */
 public static function get_context()
 {
     $data = array();
     $data['http_host'] = 'http://' . TimberURLHelper::get_host();
     $data['wp_title'] = TimberHelper::get_wp_title();
     $data['wp_head'] = TimberHelper::function_wrapper('wp_head');
     $data['wp_footer'] = TimberHelper::function_wrapper('wp_footer');
     $data['body_class'] = implode(' ', get_body_class());
     $data['site'] = new TimberSite();
     $data['theme'] = $data['site']->theme;
     //deprecated, these should be fetched via TimberSite or TimberTheme
     $data['theme_dir'] = WP_CONTENT_SUBDIR . str_replace(WP_CONTENT_DIR, '', get_stylesheet_directory());
     $data['language_attributes'] = TimberHelper::function_wrapper('language_attributes');
     $data['stylesheet_uri'] = get_stylesheet_uri();
     $data['template_uri'] = get_template_directory_uri();
     $data['posts'] = Timber::query_posts();
     //deprecated, this should be fetched via TimberMenu
     if (function_exists('wp_nav_menu')) {
         $locations = get_nav_menu_locations();
         if (count($locations)) {
             $data['wp_nav_menu'] = wp_nav_menu(array('container_class' => 'menu-header', 'echo' => false, 'menu_class' => 'nav-menu'));
         }
     }
     $data = apply_filters('timber_context', $data);
     $data = apply_filters('timber/context', $data);
     return $data;
 }
Example #2
0
 /**
  * Get context.
  *
  * @return array
  */
 public static function get_context()
 {
     $data = array();
     $data['http_host'] = 'http://' . TimberURLHelper::get_host();
     $data['wp_title'] = TimberHelper::get_wp_title();
     $data['wp_head'] = TimberHelper::function_wrapper('wp_head');
     $data['wp_footer'] = TimberHelper::function_wrapper('wp_footer');
     $data['body_class'] = implode(' ', get_body_class());
     $data['site'] = new TimberSite();
     $data['theme'] = $data['site']->theme;
     $data['posts'] = Timber::query_posts();
     $data = apply_filters('timber_context', $data);
     $data = apply_filters('timber/context', $data);
     return $data;
 }