final function _template_redirect() { if (!$this->condition()) { return; } if (method_exists($this, 'template_redirect')) { $this->template_redirect(); } $filters = array('template_include' => 'template_include', 'appthemes_title_parts' => 'title_parts', 'appthemes_notices' => 'notices', 'breadcrumb_trail_items' => 'breadcrumbs'); // register any vars that need to be passed to loaded template if (method_exists($this, 'template_vars')) { appthemes_add_template_var($this->template_vars()); } foreach ($filters as $filter => $method) { if (method_exists($this, $method)) { add_filter($filter, array($this, $method)); } } }
/** * Make the options object instantly available in templates. * @since 3.3.2 */ function cp_set_default_template_vars() { global $cp_options; appthemes_add_template_var('cp_options', $cp_options); }
/** * Displays form. * * @param object $order * @param object $checkout * * return void */ public function display($order, $checkout) { appthemes_add_template_var(array('app_order' => $order)); appthemes_load_template('order-summary.php'); }
function widget($args, $instance) { $instance = wp_parse_args($instance, $this->defaults); extract($args); echo $before_widget; $title = apply_filters('widget_title', isset($instance['title']) ? $instance['title'] : '', $instance, $this->id_base); if (!empty($title)) { echo $before_title . $title . $after_title; } $instance = array_merge($this->defaults, $instance); $cache = wp_cache_get($this->classname, 'widget'); if (!is_array($cache)) { $cache = array(); } if (isset($cache[$this->id])) { echo $cache[$this->id]; return; } self::$i = 0; $this->args = $args; $this->args['widget_title'] = $title; $widget_query = $this->query_posts($instance); $template_path = array($instance['template'], 'content-recent-posts.php'); $template_path = locate_template($template_path); if (!$template_path) { $template_path = dirname(__FILE__) . '/templates/content-recent-posts.php'; } appthemes_add_template_var(array('instance' => $instance)); ob_start(); if ($widget_query->have_posts()) { while ($widget_query->have_posts()) { $widget_query->the_post(); $this->sub_widget(); load_template($template_path, false); } } // Reset the global $the_post as this query will have stomped on it wp_reset_postdata(); $cache[$this->id] = ob_get_flush(); wp_cache_set($this->classname, $cache, 'widget'); echo $after_widget; }
/** * Retrieves the Order template path and adds specific content variable * * @param string $content * * @return string located template path */ function get_template($content = 'summary') { appthemes_add_template_var('app_order_content', $content); return appthemes_locate_template(array('single-' . APPTHEMES_ORDER_PTYPE . '.php', "order-{$content}.php")); }