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


PHP previous_posts函数代码示例

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


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

示例1: mfn_pagination

function mfn_pagination()
{
    global $paged, $wp_query;
    $translate['next'] = mfn_opts_get('translate') ? mfn_opts_get('translate-next', 'Next page ›') : __('Next page ›', 'pindol');
    $translate['prev'] = mfn_opts_get('translate') ? mfn_opts_get('translate-prev', '‹ Prev page') : __('‹ Prev page', 'pindol');
    $wp_query->query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] : ($current = 1);
    if (empty($paged)) {
        $paged = 1;
    }
    $prev = $paged - 1;
    $next = $paged + 1;
    $end_size = 1;
    $mid_size = 2;
    $show_all = mfn_opts_get('pagination-show-all');
    $dots = false;
    if (!($total = $wp_query->max_num_pages)) {
        $total = 1;
    }
    if ($total > 1) {
        echo '<div class="pager">';
        echo '<center>';
        if ($paged > 1) {
            echo '<a class="prev_page" href="' . previous_posts(false) . '">' . $translate['prev'] . '</a>';
        }
        for ($i = 1; $i <= $total; $i++) {
            if ($i == $current) {
                echo '<a href="' . get_pagenum_link($i) . '" class="page active">' . $i . '</a>&nbsp;';
                $dots = true;
            } else {
                if ($show_all || ($i <= $end_size || $current && $i >= $current - $mid_size && $i <= $current + $mid_size || $i > $total - $end_size)) {
                    echo '<a href="' . get_pagenum_link($i) . '" class="page">' . $i . '</a>&nbsp;';
                    $dots = true;
                } elseif ($dots && !$show_all) {
                    echo '<span class="page">...</span>&nbsp;';
                    $dots = false;
                }
            }
        }
        if ($paged < $total) {
            echo '<a class="next_page" href="' . next_posts(0, false) . '">' . $translate['next'] . '</a>';
        }
        echo '</center>';
        echo '</div>' . "\n";
    }
}
开发者ID:RagnarDanneskjold,项目名称:goodbyeloans.com,代码行数:45,代码来源:theme-functions.php

示例2: the_navbuttons

    /**
     * The Navigation Buttons
     *
     * @since Fastfood 0.37
     */
    function the_navbuttons($args = '')
    {
        global $post, $paged, $wp_query;
        wp_reset_postdata();
        $is_post = is_single() && !is_attachment() && !fastfood_is_allcat();
        $is_image = is_attachment() && !fastfood_is_allcat();
        $is_page = is_singular() && !is_single() && !is_attachment() && !fastfood_is_allcat();
        $is_singular = is_singular() && !fastfood_is_allcat();
        $defaults = array('print' => 1, 'comment' => 1, 'feed' => 1, 'trackback' => 1, 'home' => 1, 'next_prev' => 1, 'up_down' => 1, 'fixed' => 1);
        $args = wp_parse_args($args, $defaults);
        $buttons = array();
        // ------- Print -------
        if (FastfoodOptions::get_opt('fastfood_navbuttons_print') && $args['print'] && $is_singular) {
            $query_vars['style'] = 'printme';
            if (get_query_var('page')) {
                $query_vars['page'] = esc_html(get_query_var('page'));
            }
            if (get_query_var('cpage')) {
                $query_vars['cpage'] = esc_html(get_query_var('cpage'));
            }
            $buttons['print'] = array('class' => '', 'a_class' => '', 'a_rel' => '', 'a_href' => add_query_arg($query_vars, get_permalink($post->ID)), 'icon_class' => 'el-icon-print', 'tooltip' => __('Print preview', 'fastfood'));
        }
        // ------- Leave a comment -------
        if (FastfoodOptions::get_opt('fastfood_navbuttons_comment') && $args['comment'] && $is_singular && comments_open($post->ID) && !post_password_required()) {
            $buttons['comment'] = array('class' => '', 'a_class' => 'show-comment-form', 'a_rel' => '', 'a_href' => '#respond', 'icon_class' => 'el-icon-comment', 'tooltip' => __('Leave a comment', 'fastfood'));
        }
        // ------- RSS feed -------
        if (FastfoodOptions::get_opt('fastfood_navbuttons_feed') && $args['feed'] && $is_singular && comments_open($post->ID) && !post_password_required()) {
            $buttons['feed'] = array('class' => '', 'a_class' => '', 'a_rel' => '', 'a_href' => get_post_comments_feed_link($post->ID, 'rss2'), 'icon_class' => 'el-icon-rss', 'tooltip' => __('feed for comments on this post', 'fastfood'));
        }
        // ------- Trackback -------
        if (FastfoodOptions::get_opt('fastfood_navbuttons_trackback') && $args['trackback'] && $is_singular && pings_open()) {
            $buttons['trackback'] = array('class' => '', 'a_class' => '', 'a_rel' => 'trackback', 'a_href' => get_trackback_url(), 'icon_class' => 'el-icon-refresh', 'tooltip' => __('Trackback URL', 'fastfood'));
        }
        // ------- Home -------
        if (FastfoodOptions::get_opt('fastfood_navbuttons_home') && $args['home']) {
            $buttons['home'] = array('class' => '', 'a_class' => '', 'a_rel' => '', 'a_href' => home_url(), 'icon_class' => 'el-icon-home', 'tooltip' => __('Home', 'fastfood'));
        }
        // ------- Back to parent post -------
        if ($is_image && !empty($post->post_parent)) {
            $buttons['image'] = array('class' => '', 'a_class' => '', 'a_rel' => 'gallery', 'a_href' => get_permalink($post->post_parent), 'icon_class' => 'el-icon-hand-left', 'tooltip' => sprintf(__('Return to %s', 'fastfood'), get_the_title($post->post_parent)));
        }
        // ------- Previous/Next image -------
        if ($is_image) {
            $images = fastfood_get_prevnext_images($post->ID);
            if ($images['prev']) {
                $buttons['prevpost'] = array('class' => '', 'a_class' => '', 'a_rel' => 'prev', 'a_href' => get_attachment_link($images['prev']), 'icon_class' => 'el-icon-chevron-left', 'tooltip' => __('Previous Image', 'fastfood'));
            }
            if ($images['next']) {
                $buttons['nextpost'] = array('class' => '', 'a_class' => '', 'a_rel' => 'next', 'a_href' => get_attachment_link($images['next']), 'icon_class' => 'el-icon-chevron-right', 'tooltip' => __('Next Image', 'fastfood'));
            }
        }
        // ------- Previous post -------
        if (FastfoodOptions::get_opt('fastfood_navbuttons_nextprev') && $args['next_prev'] && $is_post && get_previous_post()) {
            $buttons['prevpost'] = array('class' => '', 'a_class' => '', 'a_rel' => '', 'a_href' => get_permalink(get_previous_post()), 'icon_class' => 'el-icon-chevron-left', 'tooltip' => sprintf(__('Previous Post', 'fastfood') . ': %s', get_the_title(get_previous_post())));
        }
        // ------- Next post -------
        if (FastfoodOptions::get_opt('fastfood_navbuttons_nextprev') && $args['next_prev'] && $is_post && get_next_post()) {
            $buttons['nextpost'] = array('class' => '', 'a_class' => '', 'a_rel' => '', 'a_href' => get_permalink(get_next_post()), 'icon_class' => 'el-icon-chevron-right', 'tooltip' => sprintf(__('Next Post', 'fastfood') . ': %s', get_the_title(get_next_post())));
        }
        // ------- Older Posts -------
        if (FastfoodOptions::get_opt('fastfood_navbuttons_newold') && $args['next_prev'] && !$is_singular && !fastfood_is_allcat() && get_next_posts_link()) {
            $max_page = $wp_query->max_num_pages;
            $buttons['oldposts'] = array('class' => 'nb-nextprev', 'a_class' => '', 'a_rel' => '', 'a_href' => next_posts($max_page, false), 'icon_class' => 'el-icon-chevron-left', 'tooltip' => __('Older Posts', 'fastfood'));
        }
        // ------- Newer Posts -------
        if (FastfoodOptions::get_opt('fastfood_navbuttons_newold') && $args['next_prev'] && !$is_singular && !fastfood_is_allcat() && get_previous_posts_link()) {
            $buttons['newposts'] = array('class' => 'nb-nextprev', 'a_class' => '', 'a_rel' => '', 'a_href' => previous_posts(false), 'icon_class' => 'el-icon-chevron-right', 'tooltip' => __('Newer Posts', 'fastfood'));
        }
        // ------- Top -------
        if (FastfoodOptions::get_opt('fastfood_navbuttons_topbottom') && $args['up_down']) {
            $buttons['up'] = array('class' => '', 'a_class' => '', 'a_rel' => '', 'a_href' => '#', 'icon_class' => 'el-icon-chevron-up', 'tooltip' => __('Top of page', 'fastfood'));
        }
        // ------- Bottom -------
        if (FastfoodOptions::get_opt('fastfood_navbuttons_topbottom') && $args['up_down']) {
            $buttons['down'] = array('class' => '', 'a_class' => '', 'a_rel' => '', 'a_href' => '#footer', 'icon_class' => 'el-icon-chevron-down', 'tooltip' => __('Bottom of page', 'fastfood'));
        }
        /* custom buttons can be easily added to navbar using filters. eg:
        
        			add_filter( 'fastfood_filter_navbuttons', 'fastfood_add_my_button' );
        
        			function fastfood_add_my_button( $buttons ) {
        				$buttons['my-button'] = array(
        					'class'			=> 'my_button_class',
        					'a_class'		=> 'my_button_anchor_class',
        					'a_rel'			=> 'my_button_anchor_rel',
        					'a_href'		=> 'my_button_anchor_href',
        					'icon_class'	=> 'elusive_icon_class',
        					'tooltip'		=> 'my button tooltip text'
        				);
        				return $buttons;
        			}
        
        		*/
        $buttons = apply_filters('fastfood_filter_navbuttons', $buttons);
//.........这里部分代码省略.........
开发者ID:TwoBeers,项目名称:fastfood,代码行数:101,代码来源:quickbar.php

示例3: get_previous_posts_link

/**
 * Return the previous posts pages link.
 *
 * @since 2.7.0
 *
 * @param string $label Optional. Previous page link text.
 * @return string|null
 */
function get_previous_posts_link($label = null)
{
    global $paged;
    if (null === $label) {
        $label = __('&laquo; Previous Page');
    }
    if (!is_single() && $paged > 1) {
        $attr = apply_filters('previous_posts_link_attributes', '');
        return '<a href="' . previous_posts(false) . "\" {$attr}>" . preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $label) . '</a>';
    }
}
开发者ID:vpatrinica,项目名称:jfdesign,代码行数:19,代码来源:link-template.php

示例4: previous_posts_link

function previous_posts_link($label = '&laquo; Previous Page')
{
    global $paged;
    if (!is_single() && $paged > 1) {
        echo '<a href="';
        previous_posts();
        echo '">' . preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $label) . '</a>';
    }
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:9,代码来源:link-template.php

示例5: bavotasan_search_pagination

/**
 * Add search pagination
 *
 * @uses	paginate_links()
 * @uses	add_query_arg()
 *
 * @since 1.0.0
 */
function bavotasan_search_pagination($query)
{
    $max_page = $query->max_num_pages;
    $paged = get_query_var('paged') ? get_query_var('paged') : 1;
    $type = isset($query->query['post_type']) ? $query->query['post_type'] : 'post';
    $prev_search_post_type = 2 == $paged ? '' : '&#038;search_post_type=' . esc_attr($type);
    $next_post_link = str_replace('&#038;search_post_type=' . esc_attr($type), '', next_posts($max_page, false));
    $prev_post_link = str_replace('&#038;search_post_type=' . esc_attr($type), '', previous_posts(false));
    $prev_label = 2 == $paged ? __('All results &rarr;', 'tienda') : sprintf(__('Next %s results &rarr;', 'tienda'), ucfirst($type . 's'));
    // Don't print empty markup if there's only one page.
    if ($max_page < 2) {
        return;
    }
    $next_posts_link = intval($paged) + 1 <= $max_page ? '<a href="' . esc_url($next_post_link) . '&#038;search_post_type=' . esc_attr($type) . '">' . sprintf(__('&larr; Previous %s results', 'tienda'), ucfirst($type . 's')) . '</a>' : '';
    $prev_posts_link = $paged > 1 ? '<a href="' . esc_url($prev_post_link) . $prev_search_post_type . '">' . $prev_label . '</a>' : '';
    ?>

	<nav class="navigation clearfix" role="navigation">
		<h1 class="sr-only"><?php 
    _e('Posts navigation', 'tienda');
    ?>
</h1>
		<?php 
    if ($next_posts_link) {
        ?>
		<div class="nav-previous"><?php 
        echo $next_posts_link;
        ?>
</div>
		<?php 
    }
    ?>

		<?php 
    if ($prev_posts_link) {
        ?>
		<div class="nav-next"><?php 
        echo $prev_posts_link;
        ?>
</div>
		<?php 
    }
    ?>
	</nav><!-- .navigation -->
	<?php 
    wp_reset_query();
}
开发者ID:aleffsantos,项目名称:Frameye-WebApp,代码行数:55,代码来源:functions.php

示例6: previous_posts

echo $paged > 1 ? "" : "paging-disabled";
?>
">
			
								<span class="paging-text paging-inline">
									<a <?php 
print $paged > 1 ? 'href="' . previous_posts(false) . '"' : "";
?>
><?php 
_e('Newer Post', 'Krypton');
?>
</a>
								</span> 
								<span class="btn-arrow paging-inline">
									<a <?php 
print $paged > 1 ? 'href="' . previous_posts(false) . '"' : "";
?>
><i class="icon-right-open-big"></i></a>
								</span>
							</span>
			</div>
		</div>
		</div>

<?php 
if ('sidebar-right' == $sidebar_position) {
    ?>
			<div class="col-sm-4 sidebar">
				<?php 
    get_sidebar();
    ?>
开发者ID:estrategasdigitales,项目名称:lactibox,代码行数:31,代码来源:blogclassic.php

示例7: get_portfolio_item

 /**
  * Get portfolio objects for portfolio module
  *
  * @param array  arguments that affect et_pb_portfolio query
  * @param array  passed conditional tag for update process
  * @param array  passed current page params
  * @return array portfolio item data
  */
 static function get_portfolio_item($args = array(), $conditional_tags = array(), $current_page = array())
 {
     $defaults = array('posts_number' => 10, 'include_categories' => 0, 'fullwidth' => 'on');
     $args = wp_parse_args($args, $defaults);
     // Native conditional tag only works on page load. Data update needs $conditional_tags data
     $is_front_page = et_fb_conditional_tag('is_front_page', $conditional_tags);
     $is_search = et_fb_conditional_tag('is_search', $conditional_tags);
     // Prepare query arguments
     $query_args = array('posts_per_page' => (int) $args['posts_number'], 'post_type' => 'project', 'post_status' => 'publish');
     // Conditionally get paged data
     if (defined('DOING_AJAX') && isset($current_page['paged'])) {
         $et_paged = intval($current_page['paged']);
     } else {
         $et_paged = $is_front_page ? get_query_var('page') : get_query_var('paged');
     }
     if ($is_front_page) {
         $paged = $et_paged;
     }
     if (!is_search()) {
         $query_args['paged'] = $et_paged;
     }
     // Passed categories parameter
     if ('' !== $args['include_categories']) {
         $query_args['tax_query'] = array(array('taxonomy' => 'project_category', 'field' => 'id', 'terms' => explode(',', $args['include_categories']), 'operator' => 'IN'));
     }
     // Get portfolio query
     $query = new WP_Query($query_args);
     // Format portfolio output, and add supplementary data
     $width = 'on' === $args['fullwidth'] ? 1080 : 400;
     $width = (int) apply_filters('et_pb_portfolio_image_width', $width);
     $height = 'on' === $args['fullwidth'] ? 9999 : 284;
     $height = (int) apply_filters('et_pb_portfolio_image_height', $height);
     $classtext = 'on' === $args['fullwidth'] ? 'et_pb_post_main_image' : '';
     $titletext = get_the_title();
     // Loop portfolio item data and add supplementary data
     if ($query->have_posts()) {
         $post_index = 0;
         while ($query->have_posts()) {
             $query->the_post();
             $categories = array();
             $categories_object = get_the_terms(get_the_ID(), 'project_category');
             if (!empty($categories_object)) {
                 foreach ($categories_object as $category) {
                     $categories[] = array('id' => $category->term_id, 'label' => $category->name, 'permalink' => get_term_link($category));
                 }
             }
             // Get thumbnail
             $thumbnail = get_thumbnail($width, $height, $classtext, $titletext, $titletext, false, 'Blogimage');
             // Append value to query post
             $query->posts[$post_index]->post_permalink = get_permalink();
             $query->posts[$post_index]->post_thumbnail = print_thumbnail($thumbnail['thumb'], $thumbnail['use_timthumb'], $titletext, $width, $height, '', false, true);
             $query->posts[$post_index]->post_categories = $categories;
             $query->posts[$post_index]->post_class_name = get_post_class('', get_the_ID());
             $post_index++;
         }
         $query->posts_next = array('label' => esc_html__('&laquo; Older Entries', 'et_builder'), 'url' => next_posts($query->max_num_pages, false));
         $query->posts_prev = array('label' => esc_html__('Next Entries &raquo;', 'et_builder'), 'url' => $et_paged > 1 ? previous_posts(false) : '');
         // Added wp_pagenavi support
         $query->wp_pagenavi = function_exists('wp_pagenavi') ? wp_pagenavi(array('query' => $query, 'echo' => false)) : false;
     }
     wp_reset_postdata();
     return $query;
 }
开发者ID:pacificano,项目名称:pacificano,代码行数:71,代码来源:main-modules.php

示例8: dt_get_previous_posts_link

/**
 * Description here.
 *
 * @see get_previous_posts_link
 */
function dt_get_previous_posts_link($label = null, $attr = '')
{
    global $paged;
    if (null === $label) {
        $label = '';
    }
    $nextpage = intval($paged) - 1;
    if ($nextpage < 1) {
        $nextpage = 1;
    }
    if (!is_single() && $paged > 1) {
        $attr = apply_filters('dt_previous_posts_link_attributes', $attr, $nextpage);
        return '<a href="' . previous_posts(false) . "\" {$attr}>" . preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $label) . '</a>';
    }
    return '';
}
开发者ID:scottnkerr,项目名称:eeco,代码行数:21,代码来源:dt-pagination.php

示例9: array

<?php

$navigation = array("next" => null, "prev" => null);
global $wp_query;
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
$max_page = $wp_query->max_num_pages;
if (!is_single()) {
    if (empty($paged) || $paged + 1 <= $max_page) {
        apply_filters('next_posts_link_attributes', '');
        $navigation['next'] = next_posts($max_page, false);
    }
    if ($paged > 1) {
        apply_filters('previous_posts_link_attributes', '');
        $navigation['prev'] = previous_posts(false);
    }
}
foreach ($navigation as $direction => $url) {
    ?>
<navigation type="<?php 
    echo $direction;
    ?>
" show="<?php 
    echo $url != null ? "true" : "false";
    ?>
">
	<url><![CDATA[<?php 
    echo $url;
    ?>
]]></url>
</navigation>
<?php 
开发者ID:alpual,项目名称:Caitlin-Sabo,代码行数:31,代码来源:footer-nav.php

示例10: cryptum_get_previous_posts_link_checked

/**
 * Gets the previous posts link, checked against whether the page exists or not
 *
 * @since Cryptum 1.0
 */
function cryptum_get_previous_posts_link_checked($max_page = 0)
{
    global $paged;
    if (!is_single() && $paged > 1) {
        return previous_posts(false);
    }
}
开发者ID:visual000,项目名称:misc,代码行数:12,代码来源:functions.php

示例11: register_plugin_scripts

 public function register_plugin_scripts()
 {
     global $wp_locale;
     // Utils
     wp_enqueue_script('o2-compare-times', plugins_url('o2/js/utils/compare-times.js'), array('jquery'));
     wp_enqueue_script('o2-events', plugins_url('o2/js/utils/events.js'), array('backbone', 'jquery'));
     wp_enqueue_script('o2-highlight-on-inview', plugins_url('o2/js/utils/highlight-on-inview.js'), array('jquery'));
     wp_enqueue_script('o2-highlight', plugins_url('o2/js/utils/jquery.highlight.js'), array('jquery'));
     wp_enqueue_script('o2-is-valid-email', plugins_url('o2/js/utils/is-valid-email.js'), array('jquery'));
     wp_enqueue_script('o2-moment', plugins_url('o2/js/utils/moment.js'), array('jquery'));
     wp_enqueue_script('o2-raw-to-filtered', plugins_url('o2/js/utils/raw-to-filtered.js'), array('jquery'));
     wp_enqueue_script('o2-plugin-caret', plugins_url('o2/js/utils/caret.js'), array('jquery'));
     wp_enqueue_script('o2-plugin-placeholder', plugins_url('o2/js/utils/jquery.placeholder.js'), array('jquery'));
     wp_enqueue_script('o2-page-visibility', plugins_url('o2/js/utils/page-visibility.js'), array('jquery'));
     wp_enqueue_script('o2-timestamp', plugins_url('o2/js/utils/timestamp.js'), array('jquery', 'o2-moment'));
     wp_enqueue_script('o2-polling', plugins_url('o2/js/utils/polling.js'), array('backbone', 'jquery', 'o2-events'));
     wp_enqueue_script('o2-query', plugins_url('o2/js/utils/query.js'), array('backbone', 'jquery'));
     wp_enqueue_script('o2-template', plugins_url('o2/js/utils/template.js'), array('backbone', 'jquery', 'wp-util'));
     wp_enqueue_script('o2-enquire', plugins_url('o2/js/utils/enquire.js'));
     // Models
     wp_enqueue_script('o2-models-base', plugins_url('o2/js/models/base.js'), array('backbone', 'jquery', 'o2-highlight', 'o2-events'));
     wp_enqueue_script('o2-models-post', plugins_url('o2/js/models/post.js'), array('o2-models-base', 'backbone', 'jquery'));
     wp_enqueue_script('o2-models-comment', plugins_url('o2/js/models/comment.js'), array('o2-models-base', 'backbone', 'jquery'));
     wp_enqueue_script('o2-models-page-meta', plugins_url('o2/js/models/page-meta.js'), array('backbone', 'jquery'));
     wp_enqueue_script('o2-models-user', plugins_url('o2/js/models/user.js'), array('backbone', 'jquery'));
     wp_enqueue_script('o2-models-search-meta', plugins_url('o2/js/models/search-meta.js'), array('backbone', 'jquery'));
     // Collections
     wp_enqueue_script('o2-collections-comments', plugins_url('o2/js/collections/comments.js'), array('o2-models-comment', 'o2-compare-times'));
     wp_enqueue_script('o2-collections-posts', plugins_url('o2/js/collections/posts.js'), array('o2-models-post', 'o2-compare-times'));
     wp_enqueue_script('o2-collections-users', plugins_url('o2/js/collections/users.js'), array('o2-models-user', 'underscore'));
     // Views
     wp_enqueue_script('o2-views-app-header', plugins_url('o2/js/views/app-header.js'), array('o2-models-page-meta', 'o2-events', 'utils', 'wp-backbone'));
     wp_enqueue_script('o2-views-comment', plugins_url('o2/js/views/comment.js'), array('o2-models-comment', 'o2-editor', 'wp-backbone'));
     wp_enqueue_script('o2-views-new-post', plugins_url('o2/js/views/new-post.js'), array('o2-models-post', 'o2-editor', 'wp-backbone'));
     wp_enqueue_script('o2-views-post', plugins_url('o2/js/views/post.js'), array('o2-models-post', 'o2-collections-comments', 'o2-editor', 'wp-backbone'));
     wp_enqueue_script('o2-views-no-posts-post', plugins_url('o2/js/views/no-posts-post.js'), array('backbone', 'jquery', 'wp-backbone'));
     wp_enqueue_script('o2-views-posts', plugins_url('o2/js/views/posts.js'), array('o2-collections-posts', 'jquery-color', 'o2-notifications', 'o2-views-no-posts-post', 'wp-backbone'));
     wp_enqueue_script('o2-views-app-footer', plugins_url('o2/js/views/app-footer.js'), array('o2-models-page-meta', 'wp-backbone'));
     wp_enqueue_script('o2-views-search-form', plugins_url('o2/js/views/search-form.js'), array('o2-models-search-meta', 'wp-backbone'));
     // Core application
     wp_enqueue_script('o2-app', plugins_url('o2/js/app/main.js'), array('o2-collections-users', 'o2-events', 'o2-keyboard', 'o2-models-page-meta', 'o2-moment', 'o2-views-app-footer', 'o2-views-app-header', 'o2-views-comment', 'o2-views-new-post', 'o2-views-post', 'o2-views-posts', 'utils'));
     // Extend o2 by writing modules. Use o2-cocktail to load everything else first.
     wp_enqueue_script('o2-cocktail', plugins_url('o2/js/utils/cocktail.js'), array('o2-app', 'o2-collections-comments', 'o2-collections-posts', 'o2-collections-users', 'o2-compare-times', 'o2-events', 'o2-highlight', 'o2-highlight-on-inview', 'o2-is-valid-email', 'o2-models-base', 'o2-models-comment', 'o2-models-page-meta', 'o2-models-post', 'o2-models-search-meta', 'o2-models-user', 'o2-moment', 'o2-page-visibility', 'o2-plugin-caret', 'o2-plugin-placeholder', 'o2-polling', 'o2-query', 'o2-raw-to-filtered', 'o2-template', 'o2-views-app-footer', 'o2-views-app-header', 'o2-views-comment', 'o2-views-new-post', 'o2-views-post', 'o2-views-posts', 'o2-views-search-form'));
     // previous_posts and next_posts can return nonsense for pages, 404 and failed search pages.  This fixes that.
     $prev_page_url = previous_posts(false);
     $next_page_url = next_posts(null, false);
     $have_posts = have_posts();
     $view_type = $this->get_view_type();
     if ('page' == $view_type || '404' == $view_type || 'search' == $view_type && !$have_posts) {
         $prev_page_url = NULL;
         $next_page_url = NULL;
     }
     // Comment threading depth
     $thread_comments_depth = 1;
     if (1 == get_option('thread_comments')) {
         $thread_comments_depth = get_option('thread_comments_depth');
     }
     if (1 > $thread_comments_depth) {
         $thread_comments_depth = 1;
     } elseif (10 < $thread_comments_depth) {
         $thread_comments_depth = 10;
     }
     // Keep the query vars from this page so we can use them for polling, etc.
     global $wp_query;
     $query_vars = $wp_query->query_vars;
     $sanitized_query_vars = array();
     $allowed_query_vars = apply_filters('o2_query_vars', array('author', 'author_name', 'cat', 'category_name', 'tag', 'tag_id', 'tax_query', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'm', 'w', 'p', 'name', 'page_id', 'pagename', 'page', 'paged', 's'));
     foreach ($query_vars as $query_var => $value) {
         if (in_array($query_var, $allowed_query_vars) && !empty($value)) {
             $sanitized_query_vars[$query_var] = $value;
         }
     }
     $query_vars = apply_filters('o2_sanitized_query_vars', $sanitized_query_vars);
     $default_polling_interval = $this->is_mobile() || $this->is_tablet() ? 60000 : 10000;
     $show_front_side_post_box = false;
     if (is_user_logged_in() && current_user_can('publish_posts')) {
         $show_front_side_post_box = is_home() || is_search() || is_tag();
     }
     $order = strtoupper(get_query_var('order'));
     if (!in_array($order, array('DESC', 'ASC'))) {
         $order = 'DESC';
     }
     // Theme options
     // @todo init default options
     $defaults = self::get_settings();
     $options = get_option('o2_options', $defaults);
     $o2_options = array('options' => array('nonce' => wp_create_nonce('o2_nonce'), 'loadTime' => time() * 1000, 'readURL' => admin_url('admin-ajax.php?action=o2_read'), 'writeURL' => admin_url('admin-ajax.php?action=o2_write'), 'userDataURL' => admin_url('admin-ajax.php?action=o2_userdata'), 'loginURL' => wp_login_url(), 'loginWithRedirectURL' => wp_login_url(home_url() . "?o2_login_complete=true"), 'pollingInterval' => (int) apply_filters('o2_polling_interval', $default_polling_interval), 'timestampFormat' => strip_tags(wp_kses_no_null(trim(__('%1$s on %2$s', 'o2')))), 'dateFormat' => apply_filters('o2_date_format', get_option('date_format')), 'timeFormat' => apply_filters('o2_time_format', get_option('time_format')), 'todayFormat' => strip_tags(wp_kses_no_null(trim(_x('%s', 'time ago today', 'o2')))), 'yesterdayFormat' => strip_tags(wp_kses_no_null(trim(__('Yesterday at %s', 'o2')))), 'compactFormat' => array('seconds' => strip_tags(wp_kses_no_null(trim(__('Now', 'o2')))), 'minutes' => strip_tags(wp_kses_no_null(trim(_x('%sm', 'time in minutes abbreviation', 'o2')))), 'hours' => strip_tags(wp_kses_no_null(trim(_x('%sh', 'time in hours abbreviation', 'o2')))), 'days' => strip_tags(wp_kses_no_null(trim(_x('%sd', 'time in days abbreviation', 'o2')))), 'weeks' => strip_tags(wp_kses_no_null(trim(_x('%sw', 'time in weeks abbreviation', 'o2')))), 'months' => strip_tags(wp_kses_no_null(trim(_x('%smon', 'time in months abbreviation', 'o2')))), 'years' => strip_tags(wp_kses_no_null(trim(_x('%sy', 'time in years abbreviation', 'o2'))))), 'i18nMoment' => $this->get_i18n_moment($wp_locale, false), 'i18nLanguage' => apply_filters('o2_moment_language', 'en-o2'), 'infiniteScroll' => get_option('infinite_scroll') ? true : false, 'prevPageURL' => $prev_page_url, 'nextPageURL' => $next_page_url, 'pageTitle' => $this->get_current_page_title(), 'appContainer' => $this->get_application_container(), 'threadContainer' => apply_filters('o2_thread_container', 'article'), 'showAvatars' => apply_filters('o2_show_avatars', get_option('show_avatars')), 'frontSidePostPrompt' => $options['front_side_post_prompt'] ? $options['front_side_post_prompt'] : '', 'showFrontSidePostBox' => $show_front_side_post_box, 'showCommentsInitially' => $this->show_comments_initially(), 'userMustBeLoggedInToComment' => "1" === get_option('comment_registration'), 'requireUserNameAndEmailIfNotLoggedIn' => "1" === get_option('require_name_email'), 'viewType' => $view_type, 'showExtended' => strip_tags(wp_kses_no_null(trim(__('Show full post', 'o2')))), 'hideExtended' => strip_tags(wp_kses_no_null(trim(__('Hide extended post', 'o2')))), 'searchQuery' => get_search_query(), 'havePosts' => $have_posts, 'queryVars' => $query_vars, 'order' => $order, 'threadCommentsDepth' => $thread_comments_depth, 'isMobileOrTablet' => $this->is_mobile() || $this->is_tablet(), 'defaultAvatar' => get_option('avatar_default', 'identicon'), 'searchURL' => home_url('/'), 'homeURL' => home_url('/'), 'postId' => is_singular(array('post', 'page')) ? get_the_ID() : 0, 'mimeTypes' => get_allowed_mime_types()), 'currentUser' => o2_Fragment::get_current_user_properties(), 'appControls' => self::get_app_controls(), 'postFormExtras' => apply_filters('o2_post_form_extras', ''), 'commentFormExtras' => apply_filters('o2_comment_form_extras', ''), 'strings' => array('unsavedChanges' => __('You have unsaved changes.', 'o2'), 'saveInProgress' => __('Not all changes have been saved to the server yet. Please stay on this page until they are saved.', 'o2'), 'reloginPrompt' => __('Your session has expired. Click here to log in again. Your changes will not be lost.', 'o2'), 'reloginSuccessful' => __('You have successfully logged back in.', 'o2'), 'newCommentBy' => __('New comment by %s', 'o2'), 'newAnonymousComment' => __('New comment by someone', 'o2'), 'newPostBy' => __('New post by %s', 'o2'), 'newMentionBy' => __('%1$s mentioned you: "%2$s"', 'o2'), 'filenameNotUploadedWithType' => __('%1$s was not uploaded (%2$s files are not allowed).'), 'filenameNotUploadedNoType' => __('%1$s was not uploaded (unrecognized file type).'), 'fileTypeNotSupported' => __('Sorry, %1$s files are not allowed.'), 'unrecognizedFileType' => __('Sorry, file not uploaded (unrecognized file type).'), 'pageNotFound' => __('Apologies, but the page you requested could not be found. Perhaps searching will help.', 'o2'), 'searchFailed' => __('Apologies, but I could not find any results for that search term. Please try again.', 'o2'), 'defaultError' => __('An unexpected error occurred. Please refresh the page and try again.', 'o2'), 'previewPlaceholder' => __('Generating preview...', 'o2'), 'noPosts' => __('Ready to publish your first post? Simply use the form above.', 'o2'), 'noPostsMobile' => __('Tap the new post control below to begin writing your first post.', 'o2'), 'awaitingApproval' => __('This comment is awaiting approval.', 'o2'), 'isTrashed' => __('This comment was trashed.', 'o2'), 'prevDeleted' => __('This comment was deleted.', 'o2'), 'cancel' => __('Cancel', 'o2'), 'edit' => __('Edit', 'o2'), 'email' => __('Email', 'o2'), 'name' => __('Name', 'o2'), 'permalink' => __('Permalink', 'o2'), 'post' => _x('Post', 'Verb, to post', 'o2'), 'reply' => __('Reply', 'o2'), 'save' => __('Save', 'o2'), 'saving' => __('Saving', 'o2'), 'website' => __('Website', 'o2'), 'search' => __('Search', 'o2'), 'anonymous' => __('Someone', 'o2'), 'preview' => __('Preview', 'o2'), 'olderPosts' => __('Older posts', 'o2'), 'newerPosts' => __('Newer posts', 'o2'), 'loginToComment' => __('Login to leave a comment.', 'o2'), 'fillDetailsBelow' => __('Fill in your details below.', 'o2'), 'editingOthersComment' => __("Careful! You are editing someone else's comment.", 'o2'), 'commentURL' => __('Website', 'o2'), 'showComments' => __('Show Comments', 'o2'), 'hideComments' => __('Hide Comments', 'o2'), 'redirectedHomePostTrashed' => __('This post was trashed. You will be redirected home now.', 'o2'), 'redirectedHomePageTrashed' => __('This page was trashed. You will be redirected home now.', 'o2'), 'postBeingTrashed' => __('This post is being trashed.', 'o2'), 'pageBeingTrashed' => __('This page is being trashed.', 'o2'), 'postTrashedFailed' => __('There was an error trashing that post. Please try again in a moment.', 'o2'), 'pageTrashedFailed' => __('There was an error trashing that page. Please try again in a moment.', 'o2')));
     $o2_options = apply_filters('o2_options', $o2_options);
     // We cannot "localize" directly into the o2 object here, since that would cause
     // our early loaded models, views, etc to be blown away
     // So.... we "localize" into a o2Config object that will be "extended" into o2 itself
     // on o2.App.start
     wp_localize_script('o2-app', 'o2Config', $o2_options);
 }
开发者ID:thecancerus,项目名称:o2,代码行数:94,代码来源:o2.php

示例12: if

						<select class="post_sort_select">
							<option <? if($posts_per_page == '' || $posts_per_page == 10) { echo 'selected="selected"'; } ?> value="<?=$full_uri.'?category='.$blog_cat.'&y='.$blog_year.'&posts_amount=10'?>">10</option>
							<option <? if($posts_per_page == 20) { echo 'selected="selected"'; } ?> value="<?=$full_uri.'?category='.$blog_cat.'&y='.$blog_year.'&posts_amount=20'?>">20</option>
							<option <? if($posts_per_page == 30) { echo 'selected="selected"'; } ?> value="<?=$full_uri.'?category='.$blog_cat.'&y='.$blog_year.'&posts_amount=30'?>">30</option>
							<option <? if($posts_per_page == 40) { echo 'selected="selected"'; } ?> value="<?=$full_uri.'?category='.$blog_cat.'&y='.$blog_year.'&posts_amount=40'?>">40</option>
							<option <? if($posts_per_page == 50) { echo 'selected="selected"'; } ?> value="<?=$full_uri.'?category='.$blog_cat.'&y='.$blog_year.'posts_amount=50'?>">50</option>
						</select>
					</div>
					<!--<div class="next">
						<? 	
							$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; 
							
							if($paged == 1){
								?><a href="#" class="disabled"><?=_e('Next');?> <i class="fa fa-angle-right"></i></a><?php
							}else{
								$prev_url = previous_posts(false);
								?><a href="<?= $prev_url ?>"><?=_e('Next');?> <i class="fa fa-angle-right"></i></a><?php
							}  
						?>
					</div>-->
				  </div>
				  
				<? }else{?>
					<div class="post-pagination clearfix">
						<div class="previous">&nbsp;</div>
						<div class="post-per-page">
							Items per page
							<select class="post_sort_select">
								<option <? if($posts_per_page == '' || $posts_per_page == 10) { echo 'selected="selected"'; } ?> value="<?=$full_uri.'?category='.$blog_cat.'&y='.$blog_year.'&posts_amount='.$posts_per_page?>">10</option>
								<option <? if($posts_per_page == 20) { echo 'selected="selected"'; } ?> value="<?=$full_uri.'?category='.$blog_cat.'&y='.$blog_year.'&posts_amount=20'?>">20</option>
								<option <? if($posts_per_page == 30) { echo 'selected="selected"'; } ?> value="<?=$full_uri.'?category='.$blog_cat.'&y='.$blog_year.'&posts_amount=30'?>">30</option>
开发者ID:ronksc,项目名称:omega,代码行数:31,代码来源:content-news.php

示例13: __

        if ($i % 2 == 0) {
            echo '<div class="clear"></div>';
        }
        $i++;
    }
} else {
    if (is_category()) {
        echo '<h3 class="no_blog_entries">' . __('There are no blog posts matching this category!', TD) . '</h3>';
    } elseif (is_tag()) {
        echo '<h3 class="no_blog_entries">' . __('There are no blog posts matching this tag!', TD) . '</h3>';
    } else {
        echo '<h3 class="no_blog_entries">' . __('There are no blog posts here!', TD) . '</h3>';
    }
}
remove_filter('excerpt_length', 'kolor_excerpt_length');
$np_link = previous_posts(false);
$pp_link = next_posts(null, false);
if ($paged >= $max_pages) {
    $pp_link = '';
}
if ($paged < 2) {
    $np_link = '';
}
?>
		
		<?php 
if ($pp_link || $np_link) {
    ?>
		<!-- blog pagination -->
		<div class="pagination_prev_next">
			
开发者ID:w392807287,项目名称:FirstRepository,代码行数:30,代码来源:blocks-blog2andsidebar.php

示例14: unitedthemes_content_nav

    function unitedthemes_content_nav($nav_id)
    {
        global $wp_query, $post;
        // Don't print empty markup on single pages if there's nowhere to navigate.
        if (is_single()) {
            $previous = is_attachment() ? get_post($post->post_parent) : get_adjacent_post(false, '', true);
            $next = get_adjacent_post(false, '', false);
            if (!$next && !$previous) {
                return;
            }
        }
        // Don't print empty markup in archives if there's only one page.
        if ($wp_query->max_num_pages < 2 && (is_home() || is_archive() || is_search())) {
            return;
        }
        $nav_class = is_single() ? 'post-navigation clearfix' : 'paging-navigation clearfix';
        ?>
	<nav role="navigation" id="<?php 
        echo esc_attr($nav_id);
        ?>
" class="<?php 
        echo $nav_class;
        ?>
">

	<?php 
        if (is_single()) {
            // navigation links for single posts
            ?>

		<?php 
            previous_post_link('<div class="nav-previous">%link</div>', '<i class="fa fa-angle-left"></i>');
            ?>
		<?php 
            next_post_link('<div class="nav-next">%link</div>', '<i class="fa fa-angle-right"></i>');
            ?>

	<?php 
        } elseif ($wp_query->max_num_pages > 1 && (is_home() || is_archive() || is_search())) {
            // navigation links for home, archive, and search pages
            ?>

		<?php 
            if (get_next_posts_link()) {
                ?>
        <div class="nav-previous">
            <a href="<?php 
                next_posts();
                ?>
#to-main-content"><i class="fa fa-angle-left"></i></a>
        </div>
		<?php 
            }
            ?>

		<?php 
            if (get_previous_posts_link()) {
                ?>
		<div class="nav-next">
            <a href="<?php 
                previous_posts();
                ?>
#to-main-content"><i class="fa fa-angle-right"></i></a>
        </div>
		<?php 
            }
            ?>

	<?php 
        }
        ?>

	</nav><!-- #<?php 
        echo esc_html($nav_id);
        ?>
 -->
	<?php 
    }
开发者ID:amptdesign,项目名称:ampt-2016,代码行数:78,代码来源:ut-template-tags.php

示例15: lj_pagination

function lj_pagination($range = 10)
{
    global $paged, $wp_query;
    $paged = intval(get_query_var('paged'));
    $max_page = $wp_query->max_num_pages;
    if (empty($paged) || $paged == 0) {
        $paged = 1;
    }
    if ($max_page != 1) {
        ?>
		
				<table id="navigation">
				<tr>
				<!-- First image -->
				<td class="b">
					<?php 
        if ($paged != 1) {
            ?>
						<a href="<?php 
            previous_posts();
            ?>
"><span class="pic pre" ></span><div style="margin-right:22px"><strong>Previous</strong></div></a>
						<?php 
        } else {
            ?>
						<span class="pic first"></span><strong>&nbsp;</strong>
						<?php 
        }
        ?>
					</td>
				<!-- First image ends -->
	<?php 
        if ($max_page > $range) {
            if ($paged < $range) {
                for ($i = 1; $i <= $range + 1; $i++) {
                    echo '<td >';
                    if ($i == $paged) {
                        echo '<span class="pic  active" ></span><strong class="active_num">' . $i . '</strong>';
                    } else {
                        echo '<a href="' . get_pagenum_link($i) . '" class="" ><span class="pic loop" ></span>' . $i . '</a>';
                    }
                    echo '</td >';
                }
            } elseif ($paged >= $max_page - ceil($range / 2)) {
                for ($i = $max_page - $range; $i <= $max_page; $i++) {
                    echo '<td >';
                    if ($i == $paged) {
                        echo '<span class="pic  active" ></span><strong class="active_num">' . $i . '</strong>';
                    } else {
                        echo '<a href="' . get_pagenum_link($i) . '" class="" ><span class="pic loop" ></span>' . $i . '</a>';
                    }
                    echo '</td >';
                }
            } elseif ($paged >= $range && $paged < $max_page - ceil($range / 2)) {
                for ($i = $paged - ceil($range / 2); $i <= $paged + ceil($range / 2); $i++) {
                    echo '<td >';
                    if ($i == $paged) {
                        echo '<span class="pic  active" ></span><strong class="active_num">' . $i . '</strong>';
                    } else {
                        echo '<a href="' . get_pagenum_link($i) . '" class="" ><span class="pic loop" ></span>' . $i . '</a>';
                    }
                    echo '</td >';
                }
            }
        } else {
            for ($i = 1; $i <= $max_page; $i++) {
                echo '<td >';
                if ($i == $paged) {
                    echo '<span class="pic  active" ></span><strong class="active_num">' . $i . '</strong>';
                } else {
                    echo '<a href="' . get_pagenum_link($i) . '" class="" ><span class="pic loop" ></span>' . $i . '</a>';
                }
                echo '</td >';
            }
        }
        ?>
				<!-- last image -->
				<td>
				<?php 
        if ($paged != $max_page) {
            ?>
				<a href="<?php 
            next_posts();
            ?>
"><span class="pic last"></span><strong>Next</strong></a>
				<?php 
        } else {
            ?>
				<span class="pic last_img" ></span><strong>&nbsp;</strong>
				<?php 
        }
        ?>
				</td>
					<!-- last image -->
				</tr>
				</table>
<?php 
    }
}
开发者ID:klebercarvalho,项目名称:demo,代码行数:99,代码来源:functions.php


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