本文整理汇总了PHP中Timber::load_template方法的典型用法代码示例。如果您正苦于以下问题:PHP Timber::load_template方法的具体用法?PHP Timber::load_template怎么用?PHP Timber::load_template使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Timber
的用法示例。
在下文中一共展示了Timber::load_template方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sugestao
function sugestao($params)
{
$query = 'category_name=' . $params['name'] . '&aba=' . $params['aba'];
// if ($params['aba'] == 'geral')
// Timber::load_template('passo-3-geral.php', $query);
// else
Timber::load_template('passo-3.php', $query);
}
示例2: add_action
add_action('wp_enqueue_scripts', 'load_scripts');
update_option('siteurl', 'http://' . $_SERVER['HTTP_HOST']);
update_option('home', 'http://' . $_SERVER['HTTP_HOST']);
if (class_exists('Timber')) {
Timber::add_route('blog', function ($params) {
$sticky = get_option('sticky_posts');
$sticky = TimberHelper::array_truncate($sticky, 4);
$page = 0;
$query = array('post_type' => 'post', 'posts_per_page' => 6, 'post__not_in' => $sticky, 'offset' => $page * 6);
Timber::load_template('archive-blog.php', $query);
});
Timber::add_route('blog/page/:pg', function ($params) {
$sticky = get_option('sticky_posts');
$sticky = TimberHelper::array_truncate($sticky, 4);
$page = $params['pg'];
$page -= 1;
$page = max(0, $page);
$query = array('post_type' => 'post', 'posts_per_page' => 6, 'post__not_in' => $sticky, 'offset' => $page * 6);
Timber::load_template('archive-blog.php', $query);
});
}
if (class_exists('BladesSite')) {
BladesSite::register_post_types();
BladesSite::apply_admin_customizations();
add_action('init', function () {
BladesSite::register_post_types();
});
}
if (class_exists('ChainsawDashboard')) {
$dashboard = new ChainsawDashboard('wp-content/themes/blades/blades-dashboard.json');
}
示例3: foreach
foreach ($values as $value) {
if (array_search($value, $array) !== false) {
return true;
} else {
return false;
}
}
}
function matchesAny($matcher, $values)
{
foreach ($values as $value) {
if ($matcher === $value) {
return true;
}
}
}
/* NEWS PAGINATION */
Timber::add_route('news', function () {
$page = 0;
$query = array('post_type' => 'post', 'posts_per_page' => 2, 'offset' => $page * 2);
query_posts($query);
Timber::load_template('archive.php');
});
Timber::add_route('news/page/:pg', function ($params) {
$page = $params['pg'];
$page = max(0, $page);
$page = $page;
$query = array('post_type' => 'post', 'posts_per_page' => 2, 'paged' => $page);
query_posts($query);
Timber::load_template('archive.php');
});
示例4: testFullPathRouteDoesntExist
function testFullPathRouteDoesntExist()
{
$hello = WP_CONTENT_DIR . '/plugins/hello-foo.php';
$template = Timber::load_template($hello);
$this->assertFalse($template);
}