当前位置: 首页>>代码示例>>PHP>>正文


PHP Timber::get_pagination方法代码示例

本文整理汇总了PHP中Timber::get_pagination方法的典型用法代码示例。如果您正苦于以下问题:PHP Timber::get_pagination方法的具体用法?PHP Timber::get_pagination怎么用?PHP Timber::get_pagination使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Timber的用法示例。


在下文中一共展示了Timber::get_pagination方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_context

 /**
  * Custom implementation for get_context method.
  */
 public function get_context()
 {
     global $content_width;
     if (class_exists('Easy_Digital_Downloads')) {
         global $edd_options;
     }
     $context = Timber::get_context();
     $sidebar_primary = Timber::get_widgets('sidebar_primary');
     $sidebar_footer = Timber::get_widgets('sidebar_footer');
     $context['theme_mods'] = get_theme_mods();
     $context['site_options'] = wp_load_alloptions();
     $context['teaser_mode'] = apply_filters('maera/teaser/mode', 'excerpt');
     $context['thumbnail']['width'] = apply_filters('maera/image/width', 600);
     $context['thumbnail']['height'] = apply_filters('maera/image/height', 371);
     $context['menu']['primary'] = has_nav_menu('primary_navigation') ? new TimberMenu('primary_navigation') : null;
     $context['sidebar']['primary'] = apply_filters('maera/sidebar/primary', $sidebar_primary);
     $context['sidebar']['footer'] = apply_filters('maera/sidebar/footer', $sidebar_footer);
     $context['pagination'] = Timber::get_pagination();
     $context['comment_form'] = TimberHelper::get_comment_form();
     $context['comments_args'] = array('style' => 'ul', 'reply_text' => __('Reply', 'maera'), 'short_ping' => true, 'avatar_size' => 60);
     $context['site_logo'] = get_option('site_logo', false);
     $context['content_width'] = $content_width;
     $context['sidebar_template'] = maera_templates_sidebar();
     if (class_exists('Easy_Digital_Downloads')) {
         $data['edd_options'] = $edd_options;
         $data['download_categories'] = Timber::get_terms('download_category');
         $data['download_tags'] = Timber::get_terms('download_tag');
         $data['default_image'] = new TimberImage(get_template_directory_uri() . '/assets/images/default.png');
     }
     return apply_filters('maera/timber/context', $context);
 }
开发者ID:wpmu,项目名称:maera,代码行数:34,代码来源:class-maera-timber.php

示例2: add_to_context

 function add_to_context($context)
 {
     $context['current_url'] = TimberHelper::get_current_url();
     $context['pagination'] = Timber::get_pagination();
     $context['bethel_header_menu'] = new TimberMenu('primary');
     $context['bethel_sidebar_menu'] = new TimberMenu('sidebar');
     $context['site'] = $this;
     return $context;
 }
开发者ID:betheluniversity,项目名称:bethel-responsive-wp,代码行数:9,代码来源:functions.php

示例3: getContext

 /**
  * {@inheritdoc}
  */
 public function getContext()
 {
     $data = [];
     $data['posts'] = $this->getPosts();
     $data['title'] = __('Archive', 'zero');
     if (is_day()) {
         $data['title'] = __('Archive: ', 'zero') . get_the_date('D M Y');
     } elseif (is_month()) {
         $data['title'] = __('Archive: ', 'zero') . get_the_date('M Y');
     } elseif (is_year()) {
         $data['title'] = __('Archive: ', 'zero') . get_the_date('Y');
     } elseif (is_tag()) {
         $data['title'] = single_tag_title('', false);
     } elseif (is_category()) {
         $data['title'] = single_cat_title('', false);
     } elseif (is_post_type_archive()) {
         $data['title'] = post_type_archive_title('', false);
     }
     $data['pagination'] = \Timber::get_pagination();
     return $data;
 }
开发者ID:gwa,项目名称:zero,代码行数:24,代码来源:Archive.php

示例4: get_post_query_args

    $search_args = get_post_query_args('esdeveniment', SearchQueryType::Search, $search);
    $args = wp_parse_args($search_args, $wp_query->query);
    //search + active args
    $date_filter_args = get_post_query_args('esdeveniment', SearchQueryType::FilteredDate, $filterdate);
    $args = wp_parse_args($date_filter_args, $args);
    //all filters applied
    $date_filter_args = get_post_query_args('esdeveniment', SearchQueryType::FilteredTema, $tema);
    $args = wp_parse_args($date_filter_args, $args);
    //all filters applied
    $context_holder['selected_filter_tema'] = $tema;
    $context_holder['selected_filter_data'] = $filter;
    $context_holder['cerca'] = $search;
    $title = 'Esdeveniments - ';
    !empty($search) ? $title .= 'cerca: ' . $search . ' - ' : '';
    !empty($tema) ? $title .= 'tema: ' . get_term_name_by_slug($tema, 'esdeveniment_cat') . ' - ' : '';
    !empty($filter) ? $title .= 'data: ' . get_the_filter_date_name($filter) . ' - ' : '';
    $title .= 'Softcatalà';
} else {
    $title = 'Esdeveniments - Softcatalà';
    $description = 'Esdeveniments relacionats amb el món de la tecnologia i el català.';
    $args = $wp_query->query;
}
//Posts and pagination
query_posts($args);
$context_holder['posts'] = Timber::get_posts($args);
$context_holder['pagination'] = Timber::get_pagination();
//Context initialization
$context_filterer = new SC_ContextFilterer($context_holder);
$context_overrides = array('title' => $title, 'description' => $description);
$context = $context_filterer->get_filtered_context($context_overrides, false);
Timber::render($templates, $context);
开发者ID:softcatala,项目名称:wp-softcatala,代码行数:31,代码来源:archive-esdeveniment.php

示例5: add_to_context

 /**
  * Extend the Timber context
  *
  * @param array $context
  *
  * @return array
  */
 public static function add_to_context(array $context)
 {
     $context['is_user_logged_in'] = is_user_logged_in();
     $context['pagination'] = Timber::get_pagination();
     return $context;
 }
开发者ID:sam-suresh,项目名称:gantry5,代码行数:13,代码来源:helper.php

示例6: testPaginationInCategory

 function testPaginationInCategory($struc = '/%postname%/')
 {
     global $wp_rewrite;
     $wp_rewrite->permalink_structure = $struc;
     update_option('permalink_structure', $struc);
     $no_posts = $this->factory->post->create_many(25);
     $posts = $this->factory->post->create_many(31);
     $news_id = wp_insert_term('News', 'category');
     foreach ($posts as $post) {
         wp_set_object_terms($post, $news_id, 'category');
     }
     $this->go_to(home_url('/category/news'));
     $post_objects = Timber::get_posts(false);
     $pagination = Timber::get_pagination();
     //need to complete test
 }
开发者ID:rjagadishsingh,项目名称:timber,代码行数:16,代码来源:test-timber-pagination.php

示例7: array

/**
 * The main template file
 * This is the most generic template file in a WordPress theme
 * and one of the two required files for a theme (the other being style.css).
 * It is used to display a page when nothing more specific matches a query.
 * E.g., it puts together the home page when no home.php file exists
 *
 * Methods for TimberHelper can be found in the /functions sub-directory
 *
 * @package       WordPress
 * @subpackage    Underwood
 * @since         Underwood 0.0.1
 */
if (!class_exists('Timber')) {
    echo 'Timber not activated. Make sure you activate the plugin in <a href="/wp-admin/plugins.php#timber">/wp-admin/plugins.php</a>';
    return;
}
//$context = array();
$context = Timber::get_context();
$context['posts'] = Timber::get_posts();
$context['pagination'] = Timber::get_pagination();
/* Dynamic Sidebar */
$context['sidebar'] = Timber::get_widgets('Sidebar');
//	$sidebar_context = array();
//	$sidebar_context['related'] = Timber::get_posts('cat='.$post_cat);
//	$context['sidebar'] = Timber::get_sidebar('sidebar-related.twig', $sidebar_context);
$templates = array('index.twig');
if (is_home()) {
    array_unshift($templates, 'home.twig');
}
Timber::render($templates, $context);
开发者ID:oligoform,项目名称:timber-foundation-theme,代码行数:31,代码来源:index.php

示例8: array

<?php

// prepare data
$data = Timber::get_context();
$data['posts'] = Timber::get_posts();
$data['pagination'] = Timber::get_pagination();
$data['date_format'] = get_option('date_format');
$data['time_format'] = get_option('time_format');
// prepare template array
$templates = array();
if (is_tax()) {
    $data['term'] = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
    $templates[] = 'listing/list-taxonomy-' . $data['term']->taxonomy . '.html.twig';
    $templates[] = 'listing/list-taxonomy.html.twig';
} elseif (is_category()) {
    $data['category'] = get_category(get_query_var('cat'));
    $templates[] = 'listing/list-category-' . $data['category']->slug . '.html.twig';
    $templates[] = 'listing/list-category.html.twig';
} elseif (is_tag()) {
    $data['tag'] = get_queried_object();
    $templates[] = 'listing/list-tag-' . $data['tag']->name . '.html.twig';
    $templates[] = 'listing/list-tag.html.twig';
} elseif (is_author()) {
    $data['author'] = get_queried_object();
    $templates[] = 'listing/list-author-' . $data['author']->user_nicename . '.html.twig';
    $templates[] = 'listing/list-author.html.twig';
} elseif (is_date()) {
    if (is_year()) {
        $data['date'] = get_the_time('Y');
    } else {
        $data['date'] = get_the_time('F Y');
开发者ID:mindgruve,项目名称:mg-press,代码行数:31,代码来源:archive.php

示例9: testPaginationPrevUsesBaseAndFormatArgs

 function testPaginationPrevUsesBaseAndFormatArgs($struc = '/%postname%/')
 {
     global $wp_rewrite;
     $wp_rewrite->permalink_structure = $struc;
     update_option('permalink_structure', $struc);
     $posts = $this->factory->post->create_many(55);
     $this->go_to(home_url('/apricot/page=3'));
     query_posts('paged=3');
     $GLOBALS['paged'] = 3;
     $pagination = Timber::get_pagination(array('base' => '/apricot/%_%', 'format' => 'page=%#%'));
     $this->assertEquals('/apricot/page=2', $pagination['prev']['link']);
 }
开发者ID:connorjburton,项目名称:timber,代码行数:12,代码来源:test-timber-pagination.php

示例10: get_query_var

<?php

global $s;
$page = get_query_var('paged');
if ($page && $page >= 2) {
    // If we're on a pagination page, we'll add a "Page [page]" to the title, so
    // that SEO services don't complain about duplicate titles
    add_filter('wpseo_title', function ($title) use($page) {
        return $title . " | Page {$page}";
    });
}
Timber::render('templates/blog/search-results.twig', array_merge(Timber::get_context(), array('pagination' => Timber::get_pagination(), 'searchTerm' => $s, 'categories' => Timber::get_terms('category'), 'tags' => Timber::get_terms('tag'), 'results' => Timber::get_posts(array('post_type' => 'post', 's' => $s)))));
开发者ID:amt925,项目名称:wordpress-project-starter,代码行数:12,代码来源:search.php

示例11: get_pagination

 /**
  * get_pagination
  *
  * @return mixed
  */
 protected function get_pagination()
 {
     if (empty($this->pagination)) {
         $this->pagination = \Timber::get_pagination();
     }
     return $this->pagination;
 }
开发者ID:benedict-w,项目名称:pressgang,代码行数:12,代码来源:posts-controller.php

示例12: add_to_context

 public function add_to_context($context)
 {
     $context['regions'] = $this->get_theme_regions();
     $context['menu'] = new TimberMenu();
     $context['site'] = $this;
     $context['pagination'] = Timber::get_pagination();
     $context['comment_form'] = TimberHelper::get_comment_form();
     return $context;
 }
开发者ID:oligoform,项目名称:timber-regions,代码行数:9,代码来源:site.php

示例13: get_the_archive_title

<?php

$context = Timber::get_context();
$context['posts'] = Timber::get_posts();
if (is_archive()) {
    $context['title'] = get_the_archive_title();
} else {
    $context['title'] = get_the_title(get_option('page_for_posts'));
}
$context['description'] = get_the_archive_description('<div class="archive-description">', '</div>');
$context['pagination'] = Timber::get_pagination(array('mid_size' => 2));
Timber::render('index.twig', $context);
开发者ID:trendwerk,项目名称:trendpress,代码行数:12,代码来源:index.php

示例14: get_query_var

<?php

$page = get_query_var('paged');
if ($page && $page >= 2) {
    // If we're on a pagination page, we'll add a "Page [page]" to the title, so
    // that SEO services don't complain about duplicate titles
    add_filter('wpseo_title', function ($title) use($page) {
        return $title . " | Page {$page}";
    });
}
Timber::render('templates/blog.twig', array_merge(Timber::get_context(), array('page' => new TimberPost('blog'), 'categories' => Timber::get_terms('category'), 'tags' => Timber::get_terms('tag'), 'pagination' => Timber::get_pagination())));
开发者ID:amt925,项目名称:wordpress-project-starter,代码行数:11,代码来源:home.php

示例15: testPaginationWithMoreThan10Pages

 function testPaginationWithMoreThan10Pages($struc = '/%postname%/')
 {
     global $wp_rewrite;
     $wp_rewrite->permalink_structure = $struc;
     update_option('permalink_structure', $struc);
     $posts = $this->factory->post->create_many(150);
     $this->go_to(home_url('/page/13'));
     $pagination = Timber::get_pagination();
     $expected_next_link = user_trailingslashit('http://example.org/page/14/');
     $this->assertEquals($expected_next_link, $pagination['next']['link']);
 }
开发者ID:jarednova,项目名称:timber,代码行数:11,代码来源:test-timber-pagination.php


注:本文中的Timber::get_pagination方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。