Ejemplo n.º 1
0
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);
}
Ejemplo n.º 2
0
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');
}
Ejemplo n.º 3
0
    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');
});
Ejemplo n.º 4
0
 function testFullPathRouteDoesntExist()
 {
     $hello = WP_CONTENT_DIR . '/plugins/hello-foo.php';
     $template = Timber::load_template($hello);
     $this->assertFalse($template);
 }