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";
    }
}
示例#2
0
    /**
     * 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);
        if (!$buttons) {
            return;
        }
        ?>

			<div id="navbuttons">
				<?php 
        foreach ($buttons as $button) {
            $button['class'] = $button['class'] ? ' ' . esc_attr(trim($button['class'])) : '';
            $button['icon_class'] = $button['icon_class'] ? ' ' . esc_attr(trim($button['icon_class'])) : '';
            $button['tooltip'] = esc_html($button['tooltip']);
            ?>

				<div class="minibutton<?php 
            echo $button['class'];
            ?>
">
					<?php 
            echo fastfood_build_link(array('href' => $button['a_href'], 'class' => $button['a_class'], 'rel' => $button['a_rel'], 'text' => '<i class="minib_img' . $button['icon_class'] . '"></i>'));
            ?>
					<span class="nb_tooltip"><?php 
            echo $button['tooltip'];
            ?>
</span>
				</div>

				<?php 
        }
        ?>
			</div><!-- #navbuttons -->

		<?php 
    }
示例#3
0
/**
 * 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>';
    }
}
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>';
    }
}
示例#5
0
/**
 * 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();
}
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();
    ?>
示例#7
0
 /**
  * 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;
 }
示例#8
0
/**
 * 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 '';
}
示例#9
0
<?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 
示例#10
0
/**
 * 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);
    }
}
示例#11
0
文件: o2.php 项目: thecancerus/o2
 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);
 }
示例#12
0
						<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>
        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">
			
示例#14
0
    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 
    }
示例#15
0
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 
    }
}
示例#16
0
    /**
     * Display navigation to next/previous post when applicable.
     *
     * Based on TwentyFourteen 1.0
     * @since 1.0
     */
    function wp_tiles_prev_next_nav($wp_query = false, $anchor = false)
    {
        if (!$wp_query) {
            $wp_query = $GLOBALS['wp_query'];
        }
        $next = $previous = false;
        $paged = $wp_query->get('paged', 1);
        // Previous
        if ($paged > 1) {
            $previous = true;
        }
        // Next
        $max_page = $wp_query->max_num_pages;
        $nextpage = intval($paged) + 1;
        if ($nextpage <= $max_page) {
            $next = true;
        }
        // Don't print empty markup if there's nowhere to navigate.
        if (!$next && !$previous) {
            return;
        }
        ?>

        <nav class="navigation wp-tiles-pagination wp-tiles-pagination-prev-next" role="navigation">
            <h1 class="screen-reader-text"><?php 
        _e('Post navigation', 'wp-tiles');
        ?>
</h1>
            <div class="pagination loop-pagination">
                <?php 
        if ($previous) {
            ?>
<a href='<?php 
            echo previous_posts(false);
            if ($anchor) {
                echo '#' . $anchor;
            }
            ?>
' class='prev prev-next'><?php 
            _e('&larr; Previous');
            ?>
</a><?php 
        }
        ?>

                <?php 
        if ($next) {
            ?>
<a href='<?php 
            echo next_posts($max_page, false);
            if ($anchor) {
                echo '#' . $anchor;
            }
            ?>
' class='next prev-next'><?php 
            _e('Next &rarr;');
        }
        ?>

            </div><!-- .pagination -->
        </nav><!-- .navigation -->
        <?php 
    }
 function previous_posts_link($label = '&laquo; Previous Page', $echo = true)
 {
     if ($label && empty($GLOBALS['p']) && !empty($GLOBALS['paged']) && $GLOBALS['paged'] > 1 && get_settings('what_to_show') == 'paged') {
         return _echo('<a href="' . previous_posts(false) . '">' . preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $label) . '</a>', $echo);
     }
     return _echo('', $echo);
 }
示例#18
0
/**
 * Display a pager(Newer | Older).
 */
function vicuna_paging_link($args = '')
{
    global $paged, $wpdb, $wp_query;
    if (is_array($args)) {
        $r =& $args;
    } else {
        parse_str($args, $r);
    }
    $defaults = array('next_label' => __('Older Entries', 'vicuna'), 'prev_label' => __('Newer Entries', 'vicuna'), 'indent' => '');
    $r = array_merge($defaults, $r);
    extract($r);
    if ($indent != '') {
        $indent = (int) $indent;
        for ($i = 0; $i < $indent; $i++) {
            $indentText .= "\t";
        }
    }
    // get max_page
    if (!$max_page) {
        $max_page = $wp_query->max_num_pages;
    }
    // get paged
    if (!$paged) {
        $paged = 1;
    }
    // set next page number
    $nextpage = intval($paged) + 1;
    if (!is_single()) {
        if ($max_page > 1) {
            echo "{$indentText}<ul class=\"flip pager\" id=\"flip2\">\n";
        }
        if ($paged > 1) {
            echo "{$indentText}\t<li class=\"newer\"><a href=\"";
            previous_posts();
            echo '">' . preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $prev_label) . "</a></li>\n";
        }
        if (empty($paged) || $nextpage <= $max_page) {
            echo "{$indentText}\t<li class=\"older\"><a href=\"";
            next_posts($max_page);
            echo '">' . preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $next_label) . "</a></li>\n";
        }
        if ($max_page > 1) {
            echo $indentText . '</ul>' . "\n";
        }
    }
}
示例#19
0
<div class="blog_nav row no-padding">
	<?php 
    if (get_next_posts_link()) {
        ?>
		<a href="<?php 
        echo next_posts();
        ?>
" class="next"><?php 
        _e('Older', THB_THEME_NAME);
        ?>
</a>
	<?php 
    }
    ?>

	<?php 
    if (get_previous_posts_link()) {
        ?>
		<a href="<?php 
        echo previous_posts();
        ?>
" class="prev"><?php 
        _e('Newer', THB_THEME_NAME);
        ?>
</a>
	<?php 
    }
    ?>
</div>
<?php 
}
示例#20
0
/**
 * Displays pagination on the post list page.
 *
 * @since gp 1.0
 */
function gp_content_paging()
{
    global $wp_query, $post;
    ?>
	<nav class="navigation-paging">
		<div class="js-vertical-center">
			<div class="status">
				<p><?php 
    _e('page', 'gp');
    ?>
</p>
				<h5><?php 
    echo max(1, get_query_var('paged'));
    ?>
 / <?php 
    echo $wp_query->max_num_pages;
    ?>
</h5>
			</div>

			<div class="paging"><?php 
    if (get_previous_posts_link()) {
        $prev_link = esc_attr(previous_posts(false));
        ?>
					<a href="<?php 
        echo $prev_link;
        ?>
" class="button-minimal button-icon-left icon-left-open-big button-newer"><?php 
        _e('Newer entries', 'gp');
        ?>
</a><?php 
    } else {
        ?>
					<span class="button-minimal button-icon-left icon-left-open-big button-disabled button-newer"><?php 
        _e('Newer entries', 'gp');
        ?>
</span><?php 
    }
    if (get_next_posts_link()) {
        $next_link = esc_attr(next_posts(9999999, false));
        ?>
					<a href="<?php 
        echo $next_link;
        ?>
" class="button-minimal button-icon-right icon-right-open-big button-older"><?php 
        _e('Older entries', 'gp');
        ?>
</a><?php 
    } else {
        ?>
					<span class="button-minimal button-icon-right icon-right-open-big button-disabled button-older"><?php 
        _e('Older entries', 'gp');
        ?>
</span><?php 
    }
    ?>

				<p><?php 
    _e('jump to page', 'gp');
    ?>
</p>
				<div class="wrap-page-numbers">
				<?php 
    $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, 'prev_next' => false));
    ?>
				</div>
			</div>
		</div>
	</nav>
	<?php 
}
示例#21
0
文件: post.php 项目: Getbeans/Beans
/**
 * Echo posts pagination.
 *
 * @since 1.0.0
 */
function beans_posts_pagination()
{
    /**
     * Filter whether {@see beans_posts_pagination()} should be short-circuit or not.
     *
     * @since 1.0.0
     *
     * @param bool $pre True to short-circuit, False to let the function run.
     */
    if (apply_filters('beans_pre_post_pagination', is_singular())) {
        return;
    }
    global $wp_query;
    if ($wp_query->max_num_pages <= 1) {
        return;
    }
    $current = get_query_var('paged') ? absint(get_query_var('paged')) : 1;
    $count = intval($wp_query->max_num_pages);
    beans_open_markup_e('beans_posts_pagination', 'ul', array('class' => 'uk-pagination uk-grid-margin', 'role' => 'navigation'));
    // Previous.
    if (get_previous_posts_link()) {
        beans_open_markup_e('beans_posts_pagination_item[_previous]', 'li');
        beans_open_markup_e('beans_previous_link[_posts_pagination]', 'a', array('href' => previous_posts(false)), $current);
        beans_open_markup_e('beans_previous_icon[_posts_pagination]', 'i', array('class' => 'uk-icon-angle-double-left uk-margin-small-right'));
        beans_close_markup_e('beans_previous_icon[_posts_pagination]', 'i');
        beans_output_e('beans_previous_text[_posts_pagination]', __('Previous', 'tm-beans'));
        beans_close_markup_e('beans_previous_link[_posts_pagination]', 'a');
        beans_close_markup_e('beans_posts_pagination_item[_previous]', 'li');
    }
    // Links.
    foreach (range(1, $wp_query->max_num_pages) as $link) {
        // Skip if next is set.
        if (isset($next) && $link != $next) {
            continue;
        } else {
            $next = $link + 1;
        }
        $is_separator = array(1 != $link, 1 == $current && 3 == $link ? false : true, $count > 3, $count != $link, $current - 1 != $link, $current != $link, $current + 1 != $link);
        // Separator.
        if (!in_array(false, $is_separator)) {
            beans_open_markup_e('beans_posts_pagination_item[_separator]', 'li');
            beans_output_e('beans_posts_pagination_item_separator_text', '...');
            beans_close_markup_e('beans_posts_pagination_item[_separator]', 'li');
            // Jump.
            if ($link < $current) {
                $next = $current - 1;
            } elseif ($link > $current) {
                $next = $count;
            }
            continue;
        }
        // Integer.
        if ($link == $current) {
            beans_open_markup_e('beans_posts_pagination_item[_active]', 'li', array('class' => 'uk-active'));
            beans_open_markup_e('beans_posts_pagination_item[_active]_wrap', 'span');
            beans_output_e('beans_posts_pagination_item[_active]_text', $link);
            beans_close_markup_e('beans_posts_pagination_item[_active]_wrap', 'span');
            beans_close_markup_e('beans_posts_pagination_item[_active]', 'li');
        } else {
            beans_open_markup_e('beans_posts_pagination_item', 'li');
            beans_open_markup_e('beans_posts_pagination_item_link', 'a', array('href' => get_pagenum_link($link)), $link);
            beans_output_e('beans_posts_pagination_item_link_text', $link);
            beans_close_markup_e('beans_posts_pagination_item_link', 'a');
            beans_close_markup_e('beans_posts_pagination_item', 'li');
        }
    }
    // Next.
    if (get_next_posts_link()) {
        beans_open_markup_e('beans_posts_pagination_item[_next]', 'li');
        beans_open_markup_e('beans_next_link[_posts_pagination]', 'a', array('href' => next_posts($count, false)), $current);
        beans_output_e('beans_next_text[_posts_pagination]', __('Next', 'tm-beans'));
        beans_open_markup_e('beans_next_icon[_posts_pagination]', 'i', array('class' => 'uk-icon-angle-double-right uk-margin-small-left'));
        beans_close_markup_e('beans_next_icon[_posts_pagination]', 'i');
        beans_close_markup_e('beans_next_link[_posts_pagination]', 'a');
        beans_close_markup_e('beans_posts_pagination_item[_next]', 'li');
    }
    beans_close_markup_e('beans_posts_pagination', 'ul');
}
示例#22
0
function previous_posts_link($label = '<< Previous Page')
{
    global $p, $paged, $what_to_show;
    if (empty($p) && $paged > 1 && $what_to_show == 'paged') {
        echo '<a href="';
        echo previous_posts();
        echo '">' . htmlspecialchars($label) . '</a>';
    }
}
示例#23
0
 /**
  * Get pagination.
  *
  * @param array   $prefs
  * @return array mixed
  */
 public static function get_pagination($prefs = array())
 {
     global $wp_query;
     global $paged;
     global $wp_rewrite;
     $args = array();
     $args['total'] = ceil($wp_query->found_posts / $wp_query->query_vars['posts_per_page']);
     if ($wp_rewrite->using_permalinks()) {
         $url = explode('?', get_pagenum_link(0));
         if (isset($url[1])) {
             parse_str($url[1], $query);
             $args['add_args'] = $query;
         }
         $args['format'] = 'page/%#%';
         $args['base'] = trailingslashit($url[0]) . '%_%';
     } else {
         $big = 999999999;
         $args['base'] = str_replace($big, '%#%', esc_url(get_pagenum_link($big)));
     }
     $args['type'] = 'array';
     $args['current'] = max(1, get_query_var('paged'));
     $args['mid_size'] = max(9 - $args['current'], 3);
     $args['prev_next'] = false;
     if (is_int($prefs)) {
         $args['mid_size'] = $prefs - 2;
     } else {
         $args = array_merge($args, $prefs);
     }
     $data = array();
     $data['current'] = $args['current'];
     $data['total'] = $args['total'];
     $data['pages'] = TimberHelper::paginate_links($args);
     $next = get_next_posts_page_link($args['total']);
     if ($next) {
         $data['next'] = array('link' => untrailingslashit($next), 'class' => 'page-numbers next');
     }
     $prev = previous_posts(false);
     if ($prev) {
         $data['prev'] = array('link' => untrailingslashit($prev), 'class' => 'page-numbers prev');
     }
     if ($paged < 2) {
         $data['prev'] = '';
     }
     return $data;
 }
示例#24
0
                    <?php 
    if (!is_front_page() && $has_next) {
        ?>
                        document.location.href = '<?php 
        next_posts();
        ?>
';
               		<?php 
    }
    ?>
                } else if(current_position == MousePosition.LEFT) {
                    <?php 
    if (!is_front_page() && $has_prev) {
        ?>
                        document.location.href = '<?php 
        previous_posts();
        ?>
';
                	<?php 
    }
    ?>
                }
            });
        });
    </script>
<?php 
}
wp_reset_query();
?>
</div>
示例#25
0
 function previous_posts_link($label, $before, $after)
 {
     global $paged;
     if (!is_single() && $paged > 1) {
         echo $before . '<a href="';
         previous_posts();
         echo '">' . preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $label) . '</a>' . $after;
     }
 }
示例#26
0
    ?>
<div class="pagination row">
	<?php 
    if ($next) {
        ?>
		<a href='<?php 
        echo next_posts(false, 0);
        ?>
' class='button'> <?php 
        _e('Older Entries', 'frank_theme');
        ?>
 </a>
	<?php 
    }
    ?>
	<?php 
    if ($prev) {
        ?>
		<a href='<?php 
        echo previous_posts(false, 0);
        ?>
' class='button'> <?php 
        _e('Newer Entries', 'frank_theme');
        ?>
 </a>
	<?php 
    }
    ?>
</div>
<?php 
}
function previous_posts_link($label = '&laquo; Previous Page')
{
    global $p, $paged, $what_to_show;
    if (empty($p) && $paged > 1 && $what_to_show == 'paged') {
        echo '<a href="';
        previous_posts();
        echo '">' . preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $label) . '</a>';
    }
}
示例#28
0
function mfn_pagination($query = false)
{
    global $wp_query;
    $paged = get_query_var('paged') ? get_query_var('paged') : (get_query_var('page') ? get_query_var('page') : 1);
    // default $wp_query
    if (!$query) {
        $query = $wp_query;
    }
    $translate['prev'] = mfn_opts_get('translate') ? mfn_opts_get('translate-prev', '&lsaquo; Prev page') : __('Prev page', 'betheme');
    $translate['next'] = mfn_opts_get('translate') ? mfn_opts_get('translate-next', 'Next page &rsaquo;') : __('Next page', 'betheme');
    $query->query_vars['paged'] > 1 ? $current = $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 = $query->max_num_pages)) {
        $total = 1;
    }
    $output = '';
    if ($total > 1) {
        $output .= '<div class="column one pager_wrapper">';
        $output .= '<div class="pager">';
        if ($paged > 1) {
            $output .= '<a class="prev_page" href="' . previous_posts(false) . '"><i class="icon-left-open"></i>' . $translate['prev'] . '</a>';
        }
        $output .= '<div class="pages">';
        for ($i = 1; $i <= $total; $i++) {
            if ($i == $current) {
                $output .= '<a href="' . get_pagenum_link($i) . '" class="page active">' . $i . '</a>';
                $dots = true;
            } else {
                if ($show_all || ($i <= $end_size || $current && $i >= $current - $mid_size && $i <= $current + $mid_size || $i > $total - $end_size)) {
                    $output .= '<a href="' . get_pagenum_link($i) . '" class="page">' . $i . '</a>';
                    $dots = true;
                } elseif ($dots && !$show_all) {
                    $output .= '<span class="page">...</span>';
                    $dots = false;
                }
            }
        }
        $output .= '</div>';
        if ($paged < $total) {
            $output .= '<a class="next_page" href="' . next_posts(0, false) . '">' . $translate['next'] . '<i class="icon-right-open"></i></a>';
        }
        $output .= '</div>';
        $output .= '</div>' . "\n";
    }
    return $output;
}
示例#29
0
/**
 * Return the previous posts page link.
 *
 * @since 2.7.0
 *
 * @global int $paged
 *
 * @param string $label Optional. Previous page link text.
 * @return string|void HTML-formatted previous page link.
 */
function get_previous_posts_link($label = null)
{
    global $paged;
    if (null === $label) {
        $label = __('&laquo; Previous Page');
    }
    if (!is_single() && $paged > 1) {
        /**
         * Filter the anchor tag attributes for the previous posts page link.
         *
         * @since 2.7.0
         *
         * @param string $attributes Attributes for the anchor tag.
         */
        $attr = apply_filters('previous_posts_link_attributes', '');
        return '<a href="' . previous_posts(false) . "\" {$attr}>" . preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $label) . '</a>';
    }
}
示例#30
0
 /**
  * Return the previous posts page link.
  * Somewhat similar to core WP get_previous_posts_link() function
  * Just for internal use at the moment in wf_page_counter()
  *
  * TODO: Extend in the future and enable as a basic core function in functions.php
  * TODO: Allow control of CSS class applied
  *
  * @param label - Previous page link text string
  * @return string|null
  *
  * @since 1.1
  * @updated 1.1
  */
 function wf_previous_posts_link($label = null)
 {
     global $paged;
     if (null === $label) {
         $label = __('&laquo; Previous Page', 'wonderflux');
     }
     if ($paged > 1) {
         return '<span class="page-counter-nav-prev"><a href="' . previous_posts(false) . '">' . esc_attr(wp_kses($label, '')) . '</a></span>';
     }
 }