• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wp_paginate函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wp_paginate函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_paginate函数的具体用法?PHP wp_paginate怎么用?PHP wp_paginate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: shortcode_testimonials

function shortcode_testimonials($atts)
{
    $args = array('posts_per_page' => isset($atts['per_page']) ? $atts['per_page'] : 2, 'paged' => get_query_var('paged'), 'order' => isset($atts['order']) ? $atts['order'] : 'DESC', 'orderby' => isset($atts['orderby']) ? $atts['orderby'] : 'date', 'post_type' => 'testimonial');
    $output = '';
    if (isset($atts['category'])) {
        $ids = explode(',', $atts['category']);
        $slugs = array();
        foreach ($ids as $id) {
            if ($term = get_term_by('id', $id, 'testimonial_category')) {
                $slugs[] = $term->slug;
            }
        }
        $args['testimonial_category'] = implode(',', $slugs);
    }
    if (query_posts($args)) {
        if (have_posts()) {
            ob_start();
            echo '<div class="testimonial-category">';
            while (have_posts()) {
                the_post();
                $testimonial = new WP_Testimonial(get_the_ID());
                $testimonial->word_limit = isset($atts['word_limit']) && is_numeric($atts['word_limit']) ? $atts['word_limit'] : -1;
                $testimonial->render();
            }
            $pagination = true;
            if (isset($atts['pagination']) && $atts['pagination'] == 'false') {
                $pagination = false;
            }
            if ($pagination) {
                if (function_exists('wp_paginate')) {
                    wp_paginate();
                } else {
                    global $wp_query;
                    $big = 9999999;
                    echo paginate_links(array('base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), 'format' => '?paged=%#%', 'current' => max(1, get_query_var('paged')), 'total' => $wp_query->max_num_pages));
                }
            }
            echo '</div>';
            $output = ob_get_contents();
            ob_end_clean();
        }
        wp_reset_query();
        return $output;
    }
}
开发者ID:vondervick,项目名称:clean-testimonials,代码行数:45,代码来源:shortcodes.php


示例2: get_template_part

            get_template_part('templates/post-blog-format2');
            break;
        case 'classic':
        default:
            get_template_part('templates/post-blog-classic');
            break;
    }
}
?>
				</ul>	
			</div>

			
			<div class="pagination_wrap clearfix">
				<?php 
wp_paginate();
?>
				<?php 
wp_paginate_dropdown();
?>
			</div>
			
		

		</div>


		
		<?php 
get_sidebar();
?>
开发者ID:severnrescue,项目名称:web,代码行数:31,代码来源:tag.php


示例3: weaverii_content_nav

    /**
     * Display navigation to next/previous pages when applicable
     */
    function weaverii_content_nav($nav_id, $from_search = false)
    {
        global $wp_query;
        if ($wp_query->max_num_pages > 1) {
            ?>
	<nav id="<?php 
            echo $nav_id;
            ?>
">
		<h3 class="assistive-text"><?php 
            echo __('Post navigation', 'weaver-ii');
            ?>
</h3>
<?php 
            if (weaverii_getopt('wii_nav_style') == 'prev_next') {
                ?>
		<div class="nav-previous"><?php 
                next_posts_link('<span class="meta-nav">&larr; </span>' . __('Previous Post', 'weaver-ii'));
                ?>
</div>
		<div class="nav-next"><?php 
                previous_posts_link(__('Next Post', 'weaver-ii') . '<span class="meta-nav">&rarr; </span>');
                ?>
</div>
<?php 
            } else {
                if (weaverii_getopt('wii_nav_style') == 'paged_left') {
                    echo "\t<div class=\"nav-previous\">";
                    if (function_exists('wp_pagenavi')) {
                        wp_pagenavi();
                    } else {
                        if (function_exists('wp_paginate')) {
                            wp_paginate('title=');
                        } else {
                            echo weaverii_get_paginate_archive_page_links('plain', 2, 3);
                        }
                    }
                    echo "\t</div>\n";
                } else {
                    if (weaverii_getopt('wii_nav_style') == 'paged_right') {
                        echo "\t<div class=\"nav-next\">";
                        if (function_exists('wp_pagenavi')) {
                            wp_pagenavi();
                        } else {
                            if (function_exists('wp_paginate')) {
                                wp_paginate('title=');
                            } else {
                                echo weaverii_get_paginate_archive_page_links('plain', 2, 3);
                            }
                        }
                        echo "\t</div>\n";
                    } else {
                        // Older/Newer posts
                        ?>
		<div class="nav-previous"><?php 
                        next_posts_link(__('<span class="meta-nav">&larr;</span> Older posts', 'weaver-ii'));
                        ?>
</div>
		<div class="nav-next"><?php 
                        previous_posts_link(__('Newer posts <span class="meta-nav">&rarr;</span>', 'weaver-ii'));
                        ?>
</div>
<?php 
                    }
                }
            }
            ?>
	</nav><div class="weaver-clear"></div><!-- #<?php 
            echo $nav_id;
            ?>
 -->
<?php 
        }
    }
开发者ID:mystified7545,项目名称:MyBlog,代码行数:77,代码来源:functions.php


示例4: do_shortcode

    if (($h1 = weaverii_getopt('wii_info_html2')) != '') {
        echo '<span id="infobar_html2">';
        echo do_shortcode($h1);
        echo "</span>\n";
    }
    ?>
	<span class='infobar_right'>
<?php 
    if (!weaverii_getopt_checked('wii_info_hide_pagenav')) {
        echo '<span id="infobar_paginate">';
        if (!is_singular()) {
            if (function_exists('wp_pagenavi')) {
                wp_pagenavi();
            } else {
                if (function_exists('wp_paginate')) {
                    wp_paginate('title=');
                } else {
                    echo weaverii_get_paginate_archive_page_links('plain', 2, 2);
                }
            }
        }
        echo "</span>\n";
    }
    if (weaverii_getopt('wii_info_search')) {
        if (function_exists('weaverii_plus_search_form')) {
            echo '<span id="infobar_search" style="padding-right:4px !important;display:inline-block;padding-left:20px;">';
            echo weaverii_plus_search_form('', 120);
            echo '</span>';
        } else {
            echo '<span id="infobar_search">';
            get_search_form();
开发者ID:mystified7545,项目名称:MyBlog,代码行数:31,代码来源:infobar.php


示例5: navigate_archives

 function navigate_archives($bool)
 {
     if (function_exists('wp_paginate')) {
         wp_paginate();
         $bool = true;
     }
     return $bool;
 }
开发者ID:TwoBeers,项目名称:fastfood,代码行数:8,代码来源:plug-n-play.php


示例6: the_permalink

        echo the_permalink();
        ?>
" class="read-more">Read more ...</a>
                                <!-- .entry-meta -->
                            </article><!-- #post -->
                        </div>
                    </div>

                <?php 
    }
    ?>


                <?php 
    if (function_exists('wp_paginate')) {
        wp_paginate('range=4&anchor=2&nextpage=Next&previouspage=Previous');
    }
    ?>

            <?php 
} else {
    ?>

                <div id="post-404" class="noposts">

                    <p><?php 
    _e('None found.', 'example');
    ?>
</p>

                </div><!-- /#post-404 -->
开发者ID:manhhung86it,项目名称:builder-site,代码行数:31,代码来源:news.php


示例7: wallow_navigate_archives

    function wallow_navigate_archives()
    {
        global $paged;
        if (!is_archive() && !is_search() && !is_home()) {
            return;
        }
        if (!$paged) {
            $paged = 1;
        }
        $output = '';
        $output .= get_next_posts_link() ? get_next_posts_link('&laquo; ' . __('Older Posts', 'wallow')) : '';
        $output .= get_next_posts_link() && get_previous_posts_link() ? ' | ' : '';
        $output .= get_previous_posts_link() ? get_previous_posts_link(__('Newer Posts', 'wallow') . ' &raquo;') : '';
        ?>
	<div class="nav_pages archive-navigation numeric-nav navigation-links">
	<?php 
        if (function_exists('wp_pagenavi')) {
            ?>

		<?php 
            wp_pagenavi();
            ?>

	<?php 
        } elseif (function_exists('wp_paginate')) {
            ?>

		<?php 
            wp_paginate();
            ?>

	<?php 
        } else {
            ?>

		<?php 
            echo $output;
            ?>

	<?php 
        }
        ?>
	</div>
<?php 
    }
开发者ID:TwoBeers,项目名称:wallow,代码行数:45,代码来源:functions.php


示例8: wp_pagination

    function wp_pagination($pagination_id = '', $pagination_classes = '')
    {
        global $wp_query;
        if ($wp_query->max_num_pages > 1) {
            ?>
            <nav id="<?php 
            echo $pagination_id;
            ?>
" class="pagination<?php 
            if ($pagination_classes) {
                echo ' ' . $pagination_classes;
            }
            ?>
">
        <?php 
            if (function_exists('wp_paginate')) {
                wp_paginate();
            } else {
                ?>
                <div class="pagination-prev"><?php 
                previous_posts_link('Anterior');
                ?>
</div>    
                <div class="pagination-next"><?php 
                next_posts_link('Próximo');
                ?>
</div>         
        <?php 
            }
            ?>
            </nav><!-- /.pagination -->
<?php 
        }
    }
开发者ID:ruanmer,项目名称:wp-basis,代码行数:34,代码来源:theme-functions.php


示例9: all_category_page

function all_category_page()
{
    $healthCat = get_category_by_slug('health');
    $cosmeCat = get_category_by_slug('cosme');
    $troubleCat = get_category_by_slug('trouble');
    $componentCat = get_category_by_slug('component');
    $paged = get_query_var('paged') ? get_query_var('paged') : 1;
    $args = array('paged' => $paged);
    global $wp_query;
    $tmp_query = $wp_query;
    query_posts($args);
    // fix for more tag in page
    global $more;
    $more = 0;
    ?>
	<?php 
    if (have_posts()) {
        ?>
	<section class="entryList">

	<?php 
        while (have_posts()) {
            the_post();
            ?>
		<article class="entryPiece">
			<a href="<?php 
            the_permalink();
            ?>
">
		<header class="entryHeader">
		<div class="entryInfo">
		<span class="entryDate"><?php 
            echo get_the_date("Y/m/d");
            ?>
</span>
		<?php 
            if (check_in_week(get_the_date("Y/m/d"))) {
                echo '<span class="entryMark">new</span>';
            }
            ?>
		</div>
		<!--//.entryInfo-->
		<h1><?php 
            the_title();
            ?>
</h1>
		</header>

		<div class="entryOverview">
		<div class="pic"> <?php 
            the_post_thumbnail('avatar-thumb');
            ?>
 </div>
		<div class="txt">
		<?php 
            $category = get_the_category();
            $color = "";
            foreach ($category as $key => $cat) {
                if ($cosmeCat->cat_ID == $cat->cat_ID || cat_is_ancestor_of($cosmeCat->cat_ID, $cat->cat_ID)) {
                    $color = "yellow";
                } elseif ($troubleCat->cat_ID == $cat->cat_ID || cat_is_ancestor_of($troubleCat->cat_ID, $cat->cat_ID)) {
                    $color = "blue";
                } elseif ($componentCat->cat_ID == $cat->cat_ID || cat_is_ancestor_of($componentCat->cat_ID, $cat->cat_ID)) {
                    $color = "purple";
                }
            }
            ?>
		<div class="tagMark <?php 
            echo $color;
            ?>
"><div><span><?php 
            if (isset($category[0])) {
                echo $category[0]->cat_name;
            }
            ?>
</span></div></div>
		<?php 
            the_content('', FALSE, '');
            ?>
		<div class="viewMore"><span>続きを見る</span></div>
		</div>
		</div>
		<!--//.entryOverview-->
		</a></article>

	<?php 
        }
        ?>
	</section>
	<?php 
        // Don't print empty markup if there's only one page.
        if ($wp_query->max_num_pages >= 2) {
            if (function_exists('wp_paginate')) {
                echo '<div class="pagination">';
                wp_paginate();
                $current_page = isset($wp_query->query['paged']) ? $wp_query->query['paged'] : 1;
                $total_items = $wp_query->found_posts;
                $items_per_page = $wp_query->query_vars['posts_per_page'];
                $from = ($current_page - 1) * $items_per_page + 1;
                $to = $current_page == $wp_query->max_num_pages ? $total_items : $current_page * $items_per_page;
//.........这里部分代码省略.........
开发者ID:nil-vn,项目名称:beautysite,代码行数:101,代码来源:functions.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wp_parse_args函数代码示例发布时间:2022-05-23
下一篇:
PHP wp_pagenavi函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap