/** * Include a file that's child/parent theme-aware, and can be cached into object cache or transients * * @see PodsView::view * * @param string $view Path of the file to be included, this is relative to the current theme * @param array|null $data (optional) Data to pass on to the template, using variable => value format * @param int|bool $expires (optional) Time in seconds for the cache to expire, if false caching is disabled. * @param string $cache_mode (optional) Specify the caching method to use for the view, available options include cache, transient, or site-transient * @param bool $return (optional) Whether to return the view or not, defaults to false and will echo it * * @return string|bool The view output * * @since 2.0 * @link http://pods.io/docs/pods-view/ */ function pods_view($view, $data = null, $expires = false, $cache_mode = 'cache', $return = false) { require_once PODS_DIR . 'classes/PodsView.php'; $view = PodsView::view($view, $data, $expires, $cache_mode); if ($return) { return $view; } echo $view; }
/** * Scope variables and include a template like get_template_part that's child-theme aware * * @see get_template_part * * @param string|array $template Template names (see get_template_part) * @param array $data Data to scope to the include * @param bool $return Whether to return the output (echo by default) * @return string|null Template output * * @since 2.3.9 */ function pods_template_part($template, $data = null, $return = false) { $part = PodsView::get_template_part($template, $data); if (!$return) { echo $part; return null; } return $part; }
/** * Clear a cached value * * @see PodsView::clear * * @param string|bool $key Key for the cache * @param string $cache_mode (optional) Decides the caching method to use for the view. * @param string $group Key for the group * * @return bool * * @since 2.0 */ function pods_view_clear($key = true, $cache_mode = 'cache', $group = '') { require_once PODS_DIR . 'classes/PodsView.php'; return PodsView::clear($key, $cache_mode, $group); }