Exemple #1
0
function jbst4_page_navi()
{
    // Previous/next page navigation.
    // replacement for the_posts_pagination
    // see: http://wordpress.stackexchange.com/questions/228185/is-using-the-posts-navigation-required
    echo str_replace(array('"next page-numbers"', '"previous page-numbers"'), array('"next page-numbers" aria-label="' . __('Next', 'jbst-4') . '"', '"previous page-numbers" aria-label="' . __('Previous', 'jbst-4') . '"'), get_the_posts_pagination(array('prev_text' => '<span aria-hidden="true">&laquo;</span><span class="sr-only">' . __('Previous', 'jbst-4') . '</span>', 'next_text' => '<span class="page-link" aria-hidden="true">&raquo;</span><span class="sr-only">' . __('Next', 'jbst-4') . '</span>', 'show_all' => true, 'before_page_number' => '<span class="page-link">', 'after_page_number' => '</span>', 'screen_reader_text' => __('Page navigation', 'jbst-4'))));
}
 /**
  * Display navigation to next/previous set of posts when applicable.
  *
  * @since Boutique 1.0
  *
  * @global WP_Query   $wp_query   WordPress Query object.
  * @global WP_Rewrite $wp_rewrite WordPress Rewrite object.
  */
 function kt_paging_nav()
 {
     global $wp_query, $wp_rewrite;
     // Don't print empty markup if there's only one page.
     if ($wp_query->max_num_pages < 2) {
         return;
     }
     echo get_the_posts_pagination(array('prev_text' => '<i class="fa fa-long-arrow-left"></i>', 'next_text' => '<i class="fa fa-long-arrow-right"></i>', 'screen_reader_text' => '&nbsp;', 'before_page_number' => ''));
 }
    /**
     * Display navigation to next/previous post when applicable.
     *
     * @todo Remove this function when WordPress 4.3 is released.
     */
    function sociallyviral_post_navigation()
    {
        // Don't print empty markup if there's nowhere to navigate.
        // $previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true );
        // $next     = get_adjacent_post( false, '', false );
        // if ( ! $next && ! $previous ) {
        // 	return;
        // }
        ?>
	<nav class="navigation posts-navigation" role="navigation">
		<!--Start Pagination-->
        <?php 
        $sociallyviral_nav_type = get_theme_mod('sociallyviral_pagination_position');
        if (!empty($sociallyviral_nav_type)) {
            $sociallyviral_pagination = get_the_posts_pagination(array('mid_size' => 2, 'prev_text' => __('Newer', 'sociallyviral'), 'next_text' => __('Older', 'sociallyviral')));
            echo $sociallyviral_pagination;
        } else {
            ?>
			<h2 class="screen-reader-text"><?php 
            _e('Posts navigation', 'sociallyviral');
            ?>
</h2>
			<div class="pagination nav-links">
				<?php 
            if (get_next_posts_link()) {
                ?>
					<div class="nav-previous"><?php 
                next_posts_link(__('<i class="demo-icon icon-angle-double-left"></i> Previous', 'sociallyviral'));
                ?>
</div>
				<?php 
            }
            ?>

				<?php 
            if (get_previous_posts_link()) {
                ?>
					<div class="nav-next"><?php 
                previous_posts_link(__('Next <i class="demo-icon icon-angle-double-right"></i>', 'sociallyviral'));
                ?>
</div>
				<?php 
            }
            ?>
			</div>
		<?php 
        }
        ?>
	</nav><!--End Pagination-->
	<?php 
    }
/**
 * Helper function to build a newer/older or paginated navigation element within
 * a loop of multiple entries. This takes care of all the annoying formatting
 * which usually would need to be done within a template.
 *
 * @since  1.0.0
 * @access public
 * @param  array $args An optional list of options.
 * @return string
 */
function carelib_get_posts_navigation($args = array())
{
    global $wp_query;
    // Return early if we're on a singular post or we only have one page.
    if (is_singular() || 1 === $wp_query->max_num_pages) {
        return;
    }
    $defaults = apply_filters("{$GLOBALS['carelib_prefix']}_posts_navigation_defaults", array('nav_type' => 'pagination', 'prev_link_text' => __('Newer Posts', 'carelib'), 'next_link_text' => __('Older Posts', 'carelib'), 'prev_text' => sprintf('<span class="screen-reader-text">%s</span>', __('Previous Page', 'carelib')), 'next_text' => sprintf('<span class="screen-reader-text">%s</span>', __('Next Page', 'carelib'))));
    $args = wp_parse_args($args, $defaults);
    if (function_exists('the_posts_pagination') && 'pagination' === $args['nav_type']) {
        $output = get_the_posts_pagination($args);
    } else {
        $output = '<nav ' . carelib_get_attr('nav', 'archive') . '>';
        $output .= sprintf('<span class="nav-previous">%s</span>', get_previous_posts_link($args['prev_link_text']));
        $output .= sprintf('<span class="nav-next">%s</span>', get_next_posts_link($args['next_link_text']));
        $output .= '</nav><!-- .nav-archive -->';
    }
    return apply_filters("{$GLOBALS['carelib_prefix']}_posts_navigation", $output, $args);
}
Exemple #5
0
} else {
    ?>
                
                <p>Oops! Looks like this on that day you didn't have any posts!... </p>
                
                <?php 
}
wp_reset_postdata();
?>
<!--
=== PAGINATION ===
-->
				<div id="pagination">

<?php 
$pagination = get_the_posts_pagination(array('mid_size' => 2, 'prev_text' => __('Back', 'newfangled'), 'next_text' => __('Onward', 'newfangled'), 'screen_reader_text' => __(' ')));
echo $pagination;
?>

				</div> <!--div#pagination ends-->
			</div>
			<div class="col-lg-4">
				<?php 
get_sidebar('blog');
?>
			</div>
		</div>
	</div>
	</section>

<?php 
Exemple #6
0
function raindrops_the_pagenation($html, $position)
{
    global $raindrops_document_type;
    if (function_exists('get_the_posts_pagination') && $position == 'nav-below') {
        if ($raindrops_document_type == 'html5') {
            $result = str_replace(array('role="navigation"'), array(''), get_the_posts_pagination());
            return $result;
        } elseif ($raindrops_document_type == 'xhtml') {
            $result = str_replace(array('<nav ', '</nav>'), array('<div ', '</div>'), get_the_posts_pagination());
            return $result;
        } else {
            return $html;
        }
    }
    return $html;
}
 public function shortcode_registries()
 {
     $form_action = get_permalink();
     $page = get_query_var('paged') ? get_query_var('paged') : 1;
     $args = array('post_type' => array('as-registry'), 'post_status' => array('publish'), 'posts_per_page' => '20', 'order' => 'DESC', 'orderby' => 'date', 'cache_results' => true, 'paged' => $page);
     if (isset($_REQUEST['as-group']) && !empty($_REQUEST['as-group'])) {
         $group_id = $_REQUEST['as-group'];
         $args['tax_query'] = array(array('taxonomy' => 'as-group', 'terms' => $group_id));
     }
     $group_args = array('orderby' => 'name', 'order' => 'ASC', 'hide_empty' => true, 'hierarchical' => true, 'show_count' => 1, 'taxonomy' => 'as-group', 'echo' => 0, 'name' => 'as-group', 'selected' => $group_id, 'show_option_all' => __("Show All", "as-attendance"));
     $group_select = wp_dropdown_categories($group_args);
     if (isset($_REQUEST['registry_info_date']) && !empty($_REQUEST['registry_info_date'])) {
         $date = sanitize_text_field($_REQUEST['registry_info_date']);
         $args['meta_query'] = array('date' => array('relation' => 'AND', array('key' => 'registry_info_date', 'value' => $date, 'compare' => '=')));
     }
     if (isset($_REQUEST['registry_attendee']) && !empty($_REQUEST['registry_attendee'])) {
         $person = get_page_by_title($_REQUEST['registry_attendee'], 'OBJECT', 'as-person');
         if (!is_null($person)) {
             $args['meta_query'] = array('person' => array('relation' => 'AND', array('key' => 'registry_attendee_' . $person->ID)));
         }
     }
     $query = new WP_Query($args);
     global $wp_query;
     $temp_query = $wp_query;
     $wp_query = NULL;
     $wp_query = $query;
     $registries = array();
     if ($wp_query->have_posts()) {
         $pagination = get_the_posts_pagination(array('mid_size' => 2, 'prev_text' => __('Back', 'as-attendance'), 'next_text' => __('Onward', 'as-attendance')));
         while ($wp_query->have_posts()) {
             $wp_query->the_post();
             $groups = wp_get_object_terms(get_the_ID(), 'as-group');
             if (empty($person)) {
                 $attendees_ids = get_post_meta(get_the_ID(), 'registry_attendees_ids', true);
                 if (empty($attendees_ids)) {
                     echo '0/0';
                 } else {
                     $attendees = 0;
                     foreach ($attendees_ids as $id) {
                         $attendee = get_post_meta(get_the_ID(), 'registry_attendee_' . $id, true);
                         if (isset($attendee['present']) && $attendee['present'] == "1") {
                             $attendees++;
                         }
                     }
                     $percent = $attendees * 100 / count($attendees_ids);
                     $attendance = $attendees . '/' . count($attendees_ids) . ' (' . number_format($percent, 2) . '%)';
                 }
                 $annotation = get_post_meta(get_the_ID(), 'registry_info_annotation', true);
             } else {
                 $attendee_meta = get_post_meta(get_the_ID(), 'registry_attendee_' . $person->ID, true);
                 $present = $attendee_meta['present'] ? __('Yes', 'at-attendance') : __('No', 'at-attendance');
                 $annotation = $attendee_meta['annotation'];
             }
             $registries[] = array('ID' => get_the_ID(), 'title' => get_the_title(), 'groups' => $groups, 'annotation' => $annotation, 'link' => get_the_permalink(), 'attendance' => $attendance, 'present' => $present);
         }
     }
     $wp_query = NULL;
     $wp_query = $temp_query;
     wp_reset_postdata();
     require plugin_dir_path(__FILE__) . '../templates/list-registries.php';
 }
Exemple #8
0
function ewf_sc_blog_navigation_default()
{
    return get_the_posts_pagination();
}
Exemple #9
0
         }
     }
     /** End loop divs, varies depending on the type of grid selected **/
     if ($i == $num_columns) {
         $item_string .= '</div></div><div class="fw-row basic-row">';
         $i = 0;
     } else {
         $item_string .= '</div>';
     }
     $i++;
 }
 echo $item_string;
 /** Restore original Post Data **/
 wp_reset_postdata();
 /** Custom query loop pagination **/
 $pagination = get_the_posts_pagination(array('mid_size' => 3, 'prev_text' => $prev_text, 'next_text' => $next_text));
 $prev_post = get_previous_posts_link();
 if (empty($prev_post)) {
     $greyed_prev = '<div class="prev page-numbers-faded" >' . $prev_text . '</div>';
 } else {
     $greyed_prev = '';
 }
 $next_post = get_next_posts_link();
 if (empty($next_post)) {
     $greyed_next = '<div class="next page-numbers-faded" >' . $next_text . '</div>';
 } else {
     $greyed_next = '';
 }
 /** Reset main query object **/
 $wp_query = NULL;
 $wp_query = $temp_query;
Exemple #10
0
/**
 * Posts pagination
 */
function everbox_posts_pagination()
{
    $infinite = get_theme_mod('everbox_infinite', 0);
    if ($infinite) {
        return;
    }
    $output = '';
    $output .= '<div class="pagination-wrap">';
    $output .= get_the_posts_pagination(array('mid_size' => 1, 'screen_reader_text' => ''));
    $output .= '</div>';
    echo $output;
}
/**
 * Loop pagination function for paginating loops with multiple posts.  This should be used on archive, blog, and
 * search pages.  It is not for singular views.
 *
 * @since      loop-pagination-0.1.0
 * @deprecated 3.0.0
 * @access     public
 * @param      array   $args
 * @return     string
 */
function loop_pagination($args = array())
{
    _deprecated_function(__FUNCTION__, '3.0.0', 'the_posts_pagination()');
    return isset($args['echo']) && false === $args['echo'] ? get_the_posts_pagination($args) : the_posts_pagination($args);
}
Exemple #12
0
function blog_pagination()
{
    $pagination = get_the_posts_pagination(array('mid_size' => 1, 'prev_text' => __('<span class="fa fa-chevron-left"></span>', 'textdomain'), 'next_text' => __('<span class="fa fa-chevron-right"></span>', 'textdomain'), 'screen_reader_text' => __(' ', 'textdomain')));
    echo $pagination;
}
 /**
  * Display or return HTML-formatted services.
  *
  * @since  1.0.0
  * @param  string|array $args Arguments.
  * @return string
  */
 public function the_services($args = '')
 {
     /**
      * Filter the array of default arguments.
      *
      * @since 1.0.0
      * @param array Default arguments.
      * @param array The 'the_services' function argument.
      */
     $defaults = apply_filters('cherry_the_services_default_args', array('limit' => 3, 'orderby' => 'date', 'order' => 'DESC', 'id' => 0, 'categories' => '', 'show_photo' => true, 'show_name' => true, 'size' => 'thumbnail', 'echo' => true, 'columns' => 3, 'title' => '', 'excerpt_length' => 20, 'wrap_class' => 'cherry-services', 'before_title' => '<h2 class="cherry-services_title">', 'after_title' => '</h2>', 'pager' => false, 'layout' => 'boxed', 'button_text' => __('Read More', 'cherry-services'), 'order_button_text' => __('Order', 'cherry-services'), 'template' => 'default.tmpl', 'item_class' => 'cherry-services_item', 'col_xs' => '12', 'col_sm' => '12', 'col_md' => '12', 'col_lg' => '12', 'container' => '<div class="services-listing">%s</div>'), $args);
     $args = wp_parse_args($args, $defaults);
     /**
      * Filter the array of arguments.
      *
      * @since 1.0.0
      * @param array Arguments.
      */
     $args = apply_filters('cherry_the_services_args', $args);
     $output = '';
     /**
      * Fires before the services listing.
      *
      * @since 1.0.0
      * @param array $array The array of arguments.
      */
     do_action('cherry_services_before', $args);
     // The Query.
     $query = $this->get_services($args);
     global $wp_query;
     $this->temp_query = $wp_query;
     $wp_query = null;
     $wp_query = $query;
     // Fix boolean.
     if (isset($args['pager']) && ('true' == $args['pager'] || true === $args['pager'])) {
         $args['pager'] = true;
     } else {
         $args['pager'] = false;
     }
     // The Display.
     if (is_wp_error($query)) {
         return;
     }
     $css_class = '';
     if (!empty($args['wrap_class'])) {
         $css_class .= esc_attr($args['wrap_class']) . ' ';
     }
     if (!empty($args['class'])) {
         $css_class .= esc_attr($args['class']) . ' ';
     }
     $css_class .= esc_attr($args['layout']) . '-layout';
     // Open wrapper.
     $output .= sprintf('<div class="%s">', trim($css_class));
     if (!empty($args['title'])) {
         $output .= $args['before_title'] . $args['title'] . $args['after_title'];
     }
     $collapsed = 'pricing-table' == $args['layout'] ? ' collapse-row' : '';
     if (false !== $args['columns']) {
         $output .= '<div class="row' . $collapsed . '">';
     }
     if (false !== $args['container']) {
         $output .= sprintf($args['container'], $this->get_services_loop($query, $args));
     } else {
         $output .= $this->get_services_loop($query, $args);
     }
     if (false !== $args['columns']) {
         $output .= '</div>';
     }
     // Close wrapper.
     $output .= '</div>';
     if (true == $args['pager']) {
         $output .= get_the_posts_pagination();
     }
     $wp_query = null;
     $wp_query = $this->temp_query;
     /**
      * Filters HTML-formatted services before display or return.
      *
      * @since 1.0.0
      * @param string $output The HTML-formatted services.
      * @param array  $query  List of WP_Post objects.
      * @param array  $args   The array of arguments.
      */
     $output = apply_filters('cherry_services_html', $output, $query, $args);
     wp_reset_query();
     wp_reset_postdata();
     if (true !== $args['echo']) {
         return $output;
     }
     // If "echo" is set to true.
     echo $output;
     /**
      * Fires after the services listing.
      *
      * This hook fires only when "echo" is set to true.
      *
      * @since 1.0.0
      * @param array $array The array of arguments.
      */
     do_action('cherry_services_after', $args);
 }
Exemple #14
0
    public function vc_portfolio($attributes, $content)
    {
        if (is_admin()) {
            return '';
        }
        $attributes = shortcode_atts(array('style' => false, 'align' => false, 'meta' => false, 'random_order' => false, 'pagination' => '', 'filters' => false, 'columns' => 3, 'category' => null, 'items' => null, 'ratio' => '3:2', 'with_indents' => false, 'el_class' => ''), $attributes);
        $rand_id = rand(100000, 999999);
        if (!in_array($attributes['columns'], array(2, 3, 4, 5))) {
            $attributes['columns'] = 3;
        }
        if (!in_array($attributes['ratio'], array('3:2', '4:3', '1:1', '2:3', '3:4'))) {
            $attributes['ratio'] = '3:2';
        }
        if (!in_array($attributes['style'], array('type_1', 'type_2', 'type_3', 'type_4', 'type_5', 'type_6', 'type_7', 'type_8', 'type_9', 'type_10'))) {
            $attributes['style'] = 'type_1';
        }
        if (!in_array($attributes['align'], array('left', 'right', 'center'))) {
            $attributes['align'] = 'center';
        }
        $attributes['ratio'] = str_replace(':', '-', $attributes['ratio']);
        if ($attributes['el_class'] != '') {
            $attributes['el_class'] = ' ' . $attributes['el_class'];
        }
        $attributes['items'] = intval($attributes['items']);
        $portfolio_items = (is_integer($attributes['items']) and $attributes['items'] > 0) ? $attributes['items'] : $attributes['columns'];
        $order = 'DESC';
        $order_by = 'date';
        if ($attributes['random_order'] == 'yes') {
            $attributes['pagination'] = '';
            $order = null;
            $order_by = 'rand';
        }
        global $paged;
        if (is_front_page()) {
            $page_string = 'page';
        } else {
            $page_string = 'paged';
        }
        if ($attributes['pagination'] == 1 or $attributes['pagination'] == 'yes' or $attributes['pagination'] == 'regular') {
            $paged = get_query_var($page_string) ? get_query_var($page_string) : 1;
        } else {
            $paged = 1;
        }
        $args = array('post_type' => 'us_portfolio', 'posts_per_page' => $portfolio_items, 'post_status' => 'publish', 'orderby' => $order_by, 'order' => $order, 'paged' => $paged);
        $filters_html = $sortable_class = '';
        $categories_slugs = null;
        if (!empty($attributes['category'])) {
            $categories_slugs = explode(',', $attributes['category']);
            $args['tax_query'] = array(array('taxonomy' => 'us_portfolio_category', 'field' => 'slug', 'terms' => $categories_slugs));
        }
        if ($attributes['filters'] == 1 or $attributes['filters'] == 'yes') {
            $categories = get_terms('us_portfolio_category');
            if (!empty($categories_slugs)) {
                foreach ($categories as $cat_id => $category) {
                    if (!in_array($category->slug, $categories_slugs)) {
                        unset($categories[$cat_id]);
                    }
                }
            }
            if (count($categories) > 1) {
                $filters_html .= '<div class="w-filters">
									<div class="w-filters-item active" data-filter="*">' . __('All', 'us') . '</div>';
                foreach ($categories as $category) {
                    $filters_html .= '<div class="w-filters-item" data-filter=".' . $category->slug . '">' . $category->name . '</div>';
                }
                $filters_html .= '</div>';
            }
        }
        if ($filters_html != '') {
            $sortable_class = ' type_sortable';
            // We'll need the isotope script for this, but only once
            if (!wp_script_is('us-isotope', 'enqueued')) {
                wp_enqueue_script('us-isotope');
            }
        }
        $with_indents_class = ($attributes['with_indents'] == 1 or $attributes['with_indents'] == 'yes') ? ' with_indents' : '';
        $output = '<div class="w-portfolio ' . $attributes['style'] . ' align_' . $attributes['align'] . ' columns_' . $attributes['columns'] . ' ' . 'ratio_' . $attributes['ratio'] . $sortable_class . $with_indents_class . $attributes['el_class'] . ' animate_revealgrid" id="us_portfolio_' . $rand_id . '">
						' . $filters_html;
        $output .= '<div class="w-portfolio-list">';
        global $wp_query;
        $wp_query = new WP_Query($args);
        $portfolio_order_counter = 0;
        while ($wp_query->have_posts()) {
            $wp_query->the_post();
            $portfolio_order_counter++;
            $item_categories_links = '';
            $item_categories_classes = '';
            $item_categories = get_the_terms(get_the_ID(), 'us_portfolio_category');
            if (is_array($item_categories)) {
                foreach ($item_categories as $item_category) {
                    $item_categories_links .= $item_category->name . ' / ';
                    $item_categories_classes .= ' ' . $item_category->slug;
                }
            }
            if (function_exists('mb_strlen')) {
                if (mb_strlen($item_categories_links) > 0) {
                    $item_categories_links = mb_substr($item_categories_links, 0, -2);
                }
            } else {
                if (strlen($item_categories_links) > 0) {
                    $item_categories_links = substr($item_categories_links, 0, -2);
                }
            }
            $link_ref = $link_target = '';
            $link = esc_url(apply_filters('the_permalink', get_permalink()));
            if (rwmb_meta('us_custom_link') != '') {
                $link = rwmb_meta('us_custom_link');
                if (rwmb_meta('us_custom_link_blank') == 1) {
                    $link_target = ' target="_blank"';
                }
            }
            if (rwmb_meta('us_lightbox') == 1) {
                $img_id = get_post_thumbnail_id();
                $link = wp_get_attachment_image_src($img_id, 'full');
                $link = $link[0];
                $link_ref = ' ref="magnificPopup"';
            }
            $meta_html = '';
            if ($attributes['meta'] == 'date') {
                $meta_html = get_the_date();
            } elseif ($attributes['meta'] == 'category') {
                $meta_html = $item_categories_links;
            }
            $anchor_css = '';
            if (rwmb_meta('us_title_bg_color') != '') {
                $anchor_css .= ' background-color: ' . rwmb_meta('us_title_bg_color') . ';';
            }
            if (rwmb_meta('us_title_text_color') != '') {
                $anchor_css .= ' color: ' . rwmb_meta('us_title_text_color') . ';';
            }
            if ($anchor_css != '') {
                $anchor_css = ' style="' . $anchor_css . '"';
            }
            $output .= '<div class="w-portfolio-item order_' . $portfolio_order_counter . $item_categories_classes . ' animate_reveal">
							<div class="w-portfolio-item-h">
								<a class="w-portfolio-item-anchor"' . $link_target . $link_ref . ' href="' . $link . '"' . $anchor_css . '>
									<div class="w-portfolio-item-image">';
            if (has_post_thumbnail()) {
                $output .= get_the_post_thumbnail(null, 'portfolio-list-' . $attributes['ratio'], array('class' => 'w-portfolio-item-image-first'));
            } else {
                $output .= '<img class="w-portfolio-item-image-first" src="' . get_template_directory_uri() . '/img/placeholder/500x500.gif" alt="">';
            }
            $output .= '	</div>
									<div class="w-portfolio-item-meta">
										<div class="w-portfolio-item-meta-h">
											<h2 class="w-portfolio-item-title">' . the_title('', '', FALSE) . '</h2>
											<span class="w-portfolio-item-arrow"></span>
											<span class="w-portfolio-item-text">' . $meta_html . '</span>
										</div>
									</div>
								</a>
							</div>
						</div>';
        }
        $output .= '</div>';
        if ($attributes['pagination'] == 1 or $attributes['pagination'] == 'yes' or $attributes['pagination'] == 'regular') {
            $output .= '<div class="w-portfolio-pagination">
					' . get_the_posts_pagination(array('prev_text' => '<', 'next_text' => '>', 'before_page_number' => '<span>', 'after_page_number' => '</span>')) . '
			</div>';
        } elseif ($attributes['pagination'] == 'ajax') {
            $max_num_pages = $wp_query->max_num_pages;
            if ($max_num_pages > 1) {
                $output .= '<div class="w-loadmore" id="us_load_more_' . $rand_id . '">
								<a href="javascript:void(0);" id="grid_load_more" class="g-btn color_primary type_flat size_big"><span>' . __('Load More Items', 'us') . '</span></a>
								<div class="w-preloader type_2"></div>
							</div>';
                $output .= '<script type="text/javascript">
							var page = 1,
								max_page = ' . $max_num_pages . ';
							jQuery(document).ready(function(){
								jQuery("#us_load_more_' . $rand_id . ' .g-btn").click(function(){
									jQuery("#us_load_more_' . $rand_id . '").addClass("loading");
									jQuery.ajax({
										type: "POST",
										url: "' . admin_url("admin-ajax.php") . '",
										data: {
											action: "portfolioAjaxPagination",
											columns: "' . $attributes['columns'] . '",
											items: "' . $attributes['items'] . '",
											style: "' . $attributes['style'] . '",
											align: "' . $attributes['align'] . '",
											ratio: "' . $attributes['ratio'] . '",
											with_indents: "' . $attributes['with_indents'] . '",
											meta: "' . $attributes['meta'] . '",
											filters: "' . $attributes['filters'] . '",
											category: "' . $attributes['category'] . '",
											page: page+1
										},
										success: function(data, textStatus, XMLHttpRequest){
											page++;

											var newItemsContainer = jQuery("<div>", {html:data}),
											portfolioList = jQuery("#us_portfolio_' . $rand_id . ' .w-portfolio-list");';
                if ($filters_html != '') {
                    $output .= '           newItemsContainer.imagesLoaded(function() {
												newItemsContainer.find("a[ref=magnificPopup][class!=direct-link]").magnificPopup({
													type: "image",
													fixedContentPos: false
												});

												var newItems = newItemsContainer.children();

												var iso = portfolioList.data("isotope"),
													addedItems = iso.appended(newItems.appendTo(portfolioList));
												newItems.revealGridMD();

												jQuery("#us_load_more_' . $rand_id . '").removeClass("loading").toggleClass("done", max_page <= page);
											});';
                } else {
                    $output .= '
											newItemsContainer.find("a[ref=magnificPopup][class!=direct-link]").magnificPopup({
												type: "image",
												fixedContentPos: false
											});

											var newItems = newItemsContainer.children();
											portfolioList.append(newItems);
											newItems.revealGridMD();
											newItems.find(".w-portfolio-item-h").mdRipple();
											jQuery("#us_load_more_' . $rand_id . '").removeClass("loading").toggleClass("done", max_page <= page);

												';
                }
                $output .= '

										},
										error: function(MLHttpRequest, textStatus, errorThrown){
											jQuery("#us_load_more_' . $rand_id . '").removeClass("loading");
										}
									});
								});
							});
							</script>';
            }
        }
        $output .= '</div>';
        wp_reset_query();
        return $output;
    }
Exemple #15
0
/**
 * Template tag to output pagination on archive page.
 *
 * Pagination resembles the markup from BuddyPress.
 */
function cacsp_pagination($type = 'top')
{
    // no pagination? bail!
    if ('' === get_the_posts_pagination()) {
        return;
    }
    $pag_args = array('prev_text' => _x('&larr;', 'Pagination previous text', 'social-paper'), 'next_text' => _x('&rarr;', 'Pagination next text', 'social-paper'), 'before_page_number' => '<span class="meta-nav screen-reader-text">' . __('Page', 'social-paper') . ' </span>');
    if (defined('DOING_AJAX') && true === DOING_AJAX) {
        add_filter('get_pagenum_link', create_function('', "\n\t\t\treturn trailingslashit( get_post_type_archive_link( 'cacsp_paper' ) );\n\t\t"));
        $pag_args['format'] = '';
        $pag_args['base'] = trailingslashit(get_post_type_archive_link('cacsp_paper')) . 'page/%#%/';
        if (!empty($_POST['search_terms'])) {
            $pag_args['base'] .= '?s=' . esc_attr($_POST['search_terms']);
        }
        if (!empty($_POST['scope']) && 'personal' === $_POST['scope'] && is_user_logged_in()) {
            if (!empty($_POST['search_terms'])) {
                $pag_args['base'] .= '&';
            } else {
                $pag_args['base'] .= '?';
            }
            $pag_args['base'] .= 'user='******'wp_query']->found_posts) {
        _e('Viewing 1 paper', 'social-paper');
    } else {
        $curr_page = get_query_var('paged') ? get_query_var('paged') : 1;
        $start_num = intval(($curr_page - 1) * get_query_var('posts_per_page')) + 1;
        $to_num = $start_num + (get_query_var('posts_per_page') - 1) > $GLOBALS['wp_query']->found_posts ? $GLOBALS['wp_query']->found_posts : $start_num + (get_query_var('posts_per_page') - 1);
        printf(_n('Viewing %1$s - %2$s of %3$s paper', 'Viewing %1$s - %2$s of %3$s papers', (int) $GLOBALS['wp_query']->found_posts, 'social-paper'), number_format_i18n($start_num), number_format_i18n($to_num), number_format_i18n($GLOBALS['wp_query']->found_posts));
    }
    ?>
		</div>

		<div class="pagination-links">
			<?php 
    echo paginate_links($pag_args);
    ?>
		</div>
	</div>

<?php 
}
Exemple #16
0
 function generateContent($userSettings = array())
 {
     $defaultSettings = array('page_title' => true, 'post_title' => true, 'page_meta_date' => false, 'page_meta_time' => false, 'page_meta_author' => false, 'post_meta_date' => true, 'post_meta_time' => true, 'post_meta_author' => false, 'post_content_wrapper_dom_type' => 'div', 'post_content_wrapper_class' => 'content', 'page_admin' => true, 'post_admin' => true, 'page_admin_author' => false, 'post_admin_author' => true, 'page_heading_level' => 1, 'post_heading_level' => 2, 'post_dom_type' => 'article', 'page_dom_type' => '', 'header_dom_type' => 'header', 'footer_dom_type' => 'footer', 'page_autoparagraph' => true, 'post_autoparagraph' => true);
     $settings = array_merge($defaultSettings, $userSettings);
     $content = "";
     if (have_posts()) {
         while (have_posts()) {
             the_post();
             $postContent = $heading = $meta = $machineMeta = $postDomType = "";
             // Configuring content for different post types
             if (get_post_type() != false) {
                 switch (get_post_type()) {
                     case "post":
                         $postDomType = $settings['post_dom_type'];
                         // Constructing post meta
                         if ($settings['post_meta_date']) {
                             $meta .= get_the_date();
                             $machineMeta .= get_the_date("Y-m-d");
                             if ($settings['post_meta_time']) {
                                 $meta .= ", ";
                                 $machineMeta .= " ";
                             }
                         }
                         if ($settings['post_meta_time']) {
                             $meta .= get_the_time();
                         }
                         if ($settings['post_title']) {
                             $heading = "<h" . $settings['post_heading_level'] . ">" . get_the_title() . "</h" . $settings['post_heading_level'] . ">";
                         }
                         break;
                     case "page":
                         $postDomType = $settings['page_dom_type'];
                         if ($settings['page_meta_date']) {
                             $meta .= get_the_date();
                             $machineMeta .= get_the_date("Y-m-d");
                             if ($settings['page_meta_time']) {
                                 $meta .= ", ";
                                 $machineMeta .= " ";
                             }
                         }
                         if ($settings['page_meta_time']) {
                             $meta .= get_the_time();
                             $machineMeta .= get_the_time("H:i");
                         }
                         if ($settings['page_title']) {
                             $heading = "<h" . $settings['page_heading_level'] . ">" . get_the_title() . "</h" . $settings['page_heading_level'] . ">";
                         }
                 }
             }
             if (!empty($meta)) {
                 $postContent .= "<time datetime=\"" . $machineMeta . "\" class=\"article-meta\">" . $meta . "</time>";
             }
             if (!empty($heading)) {
                 $postContent = "<" . $settings['header_dom_type'] . ">" . $heading . $postContent . "</" . $settings['header_dom_type'] . ">";
             }
             if ((current_user_can('editor') || current_user_can('administrator')) && get_post_type() == "post") {
                 if ($settings["post_admin"] && get_post_type() == "post" || $settings["page_admin"] && get_post_type() == "page") {
                     $postContent .= "<footer>\n                                            <ul>\n                                                <li><a href=\"" . get_edit_post_link() . "\">" . __('Edit', 'ease') . "</a></li>\n                                                <li><a href=\"" . get_delete_post_link() . "\">" . __('Delete', 'ease') . "</a></li>";
                     if ($settings["post_admin_author"] && get_post_type() == "post" || $settings["page_admin_author"] && get_post_type() == "page") {
                         $postContent .= "<li>" . __('Author', 'ease') . ": " . get_the_author() . "</li>";
                     }
                     $postContent .= "</ul>\n                                        </footer>";
                 }
             }
             switch (get_post_type()) {
                 case "post":
                     if (!$settings['post_autoparagraph']) {
                         remove_filter('the_content', 'wpautop');
                     }
                     break;
                 case "page":
                     if (!$settings['page_autoparagraph']) {
                         remove_filter('the_content', 'wpautop');
                     }
                     break;
             }
             ob_start();
             the_content();
             $postContentHandler = ob_get_clean();
             if (!empty($settings['post_content_wrapper_dom_type'])) {
                 $dom = "<" . $settings['post_content_wrapper_dom_type'];
                 if (!empty($settings['post_content_wrapper_class'])) {
                     $dom .= " class=\"" . $settings['post_content_wrapper_class'] . "\"";
                 }
                 $dom .= ">";
                 $postContentHandler = $dom . $postContentHandler . "</" . $settings['post_content_wrapper_dom_type'] . ">";
             }
             $postContent .= $postContentHandler;
             if ((current_user_can('editor') || current_user_can('administrator')) && get_post_type() == "page") {
                 if ($settings["post_admin"] && get_post_type() == "post" || $settings["page_admin"] && get_post_type() == "page") {
                     $postContent .= "<footer>\n                                            <ul>\n                                                <li><a href=\"" . get_edit_post_link() . "\">" . __('Edit', 'ease') . "</a></li>\n                                                <li><a href=\"" . get_delete_post_link() . "\">" . __('Delete', 'ease') . "</a></li>";
                     if ($settings["post_admin_author"] && get_post_type() == "post" || $settings["page_admin_author"] && get_post_type() == "page") {
                         $postContent .= "<li>" . __('Author', 'ease') . ": " . get_the_author() . "</li>";
                     }
                     $postContent .= "</ul>\n                                        </footer>";
                 }
             }
             if (!empty($postDomType)) {
                 $postContent = "<" . $postDomType . ">" . $postContent . "</" . $postDomType . ">";
             }
             $content .= $postContent;
         }
         $content .= get_the_posts_pagination(array('prev_text' => 'Previous Page', 'next_text' => 'Next Page', 'before_page_number' => '<span class="meta-nav screen-reader-text">Page </span>'));
     }
     return $content;
 }
Exemple #17
0
 /**
  * Display navigation to next/previous set of posts when applicable.
  *
  * @since Twenty Fourteen 1.0
  *
  * @global WP_Query   $wp_query   WordPress Query object.
  * @global WP_Rewrite $wp_rewrite WordPress Rewrite object.
  */
 function kt_paging_nav()
 {
     global $wp_query, $wp_rewrite;
     // Don't print empty markup if there's only one page.
     if ($wp_query->max_num_pages < 2) {
         return;
     }
     echo get_the_posts_pagination(array('prev_text' => sprintf('<i class="fa fa-angle-double-left"></i> %1$s', esc_attr__('Назад', 'kutetheme')), 'next_text' => sprintf('%1$s <i class="fa fa-angle-double-right"></i>', esc_attr__('Вперед', 'kutetheme')), 'screen_reader_text' => '&nbsp;', 'before_page_number' => ''));
 }
 /**
  * Display a paginated navigation to next/previous set of posts,
  * when applicable.
  *
  * @todo Remove this function when WordPress 4.3 is released.
  *
  * @param array $args Optional. See {@see get_the_posts_pagination()} for available arguments.
  *                    Default empty array.
  */
 function the_posts_pagination($args = array())
 {
     echo balanceTags(get_the_posts_pagination($args));
 }
 /**
  * Display or return HTML-formatted team.
  *
  * @since  1.0.0
  * @param  string|array $args Arguments.
  * @return string
  */
 public function the_team($args = '')
 {
     /**
      * Filter the array of default arguments.
      *
      * @since 1.0.0
      * @param array Default arguments.
      * @param array The 'the_team' function argument.
      */
     $defaults = apply_filters('cherry_the_team_default_args', array('limit' => 3, 'orderby' => 'date', 'order' => 'DESC', 'group' => '', 'id' => 0, 'show_photo' => true, 'show_name' => true, 'size' => 'thumbnail', 'echo' => true, 'title' => '', 'excerpt_length' => 20, 'wrap_class' => 'team-wrap', 'col_xs' => false, 'col_sm' => false, 'col_md' => false, 'col_lg' => false, 'before_title' => '<h2>', 'after_title' => '</h2>', 'pager' => false, 'template' => 'default.tmpl', 'item_class' => 'team-item', 'container' => '<div class="team-listing row">%s</div>'), $args);
     $args = wp_parse_args($args, $defaults);
     /**
      * Filter the array of arguments.
      *
      * @since 1.0.0
      * @param array Arguments.
      */
     $args = apply_filters('cherry_the_team_args', $args);
     $output = '';
     /**
      * Fires before the team listing.
      *
      * @since 1.0.0
      * @param array $array The array of arguments.
      */
     do_action('cherry_team_before', $args);
     // The Query.
     $query = $this->get_team($args);
     global $wp_query;
     $this->temp_query = $wp_query;
     $wp_query = NULL;
     $wp_query = $query;
     // Fix boolean.
     if (isset($args['pager']) && ('true' == $args['pager'] || true === $args['pager'])) {
         $args['pager'] = true;
     } else {
         $args['pager'] = false;
     }
     // The Display.
     if (is_wp_error($query)) {
         return;
     }
     $css_class = '';
     if (!empty($args['wrap_class'])) {
         $css_class .= esc_attr($args['wrap_class']) . ' ';
     }
     if (!empty($args['class'])) {
         $css_class .= esc_attr($args['class']);
     }
     // Open wrapper.
     $output .= sprintf('<div class="%s">', trim($css_class));
     if (!empty($args['title'])) {
         $output .= $args['before_title'] . $args['title'] . $args['after_title'];
     }
     if (false !== $args['container']) {
         $output .= sprintf($args['container'], $this->get_team_loop($query, $args));
     } else {
         $output .= $this->get_team_loop($query, $args);
     }
     // Close wrapper.
     $output .= '</div>';
     if (true == $args['pager']) {
         $output .= get_the_posts_pagination();
     }
     $wp_query = NULL;
     $wp_query = $this->temp_query;
     /**
      * Filters HTML-formatted team before display or return.
      *
      * @since 1.0.0
      * @param string $output The HTML-formatted team.
      * @param array  $query  List of WP_Post objects.
      * @param array  $args   The array of arguments.
      */
     $output = apply_filters('cherry_team_html', $output, $query, $args);
     wp_reset_query();
     wp_reset_postdata();
     if ($args['echo'] != true) {
         return $output;
     }
     // If "echo" is set to true.
     echo $output;
     /**
      * Fires after the team listing.
      *
      * This hook fires only when "echo" is set to true.
      *
      * @since 1.0.0
      * @param array $array The array of arguments.
      */
     do_action('cherry_team_after', $args);
 }
 /**
  * Returns a list of functions to add to the existing list.
  *
  * @return Twig_SimpleFunction[]
  */
 public function getFunctions()
 {
     $html_safe = ['is_safe' => array('html')];
     $funcs = [];
     // home_url
     $funcs[] = new Twig_SimpleFunction('home_url', function ($blog_id = null, $path = '', $scheme = null) {
         return get_home_url($blog_id, $path, $scheme);
     }, $html_safe);
     // blog_info
     $funcs[] = new Twig_SimpleFunction('blog_info', function ($show, $filter = 'raw') {
         return get_bloginfo($show, $filter);
     }, $html_safe);
     // wp_title
     $funcs[] = new Twig_SimpleFunction('wp_title', function ($sep = '&raquo;', $dir = '') {
         return wp_title($sep, false, $dir);
     }, $html_safe);
     // the_archive_title()
     $funcs[] = new Twig_SimpleFunction('the_archive_title', function () {
         global $wp_locale;
         if (is_category()) {
             $title = sprintf(__('Category: %s'), single_cat_title('', false));
         } elseif (is_tag()) {
             $title = sprintf(__('Tag: %s'), single_tag_title('', false));
         } elseif (is_author()) {
             $title = sprintf(__('Author: %s'), '<span class="vcard">' . get_the_author() . '</span>');
         } elseif (is_year()) {
             $title = sprintf(__('Year: %s'), get_the_date(_x('Y', 'yearly archives date format')));
         } elseif (is_month()) {
             $title = sprintf(__('Month: %s'), $wp_locale->get_month(get_query_var('monthnum')));
         } elseif (is_day()) {
             $title = sprintf(__('Day: %s'), get_the_date(_x('F j, Y', 'daily archives date format')));
         } elseif (is_tax('post_format')) {
             if (is_tax('post_format', 'post-format-aside')) {
                 $title = _x('Asides', 'post format archive title');
             } elseif (is_tax('post_format', 'post-format-gallery')) {
                 $title = _x('Galleries', 'post format archive title');
             } elseif (is_tax('post_format', 'post-format-image')) {
                 $title = _x('Images', 'post format archive title');
             } elseif (is_tax('post_format', 'post-format-video')) {
                 $title = _x('Videos', 'post format archive title');
             } elseif (is_tax('post_format', 'post-format-quote')) {
                 $title = _x('Quotes', 'post format archive title');
             } elseif (is_tax('post_format', 'post-format-link')) {
                 $title = _x('Links', 'post format archive title');
             } elseif (is_tax('post_format', 'post-format-status')) {
                 $title = _x('Statuses', 'post format archive title');
             } elseif (is_tax('post_format', 'post-format-audio')) {
                 $title = _x('Audio', 'post format archive title');
             } elseif (is_tax('post_format', 'post-format-chat')) {
                 $title = _x('Chats', 'post format archive title');
             }
         } elseif (is_post_type_archive()) {
             $title = sprintf(__('Archives: %s'), post_type_archive_title('', false));
         } elseif (is_tax()) {
             $tax = get_taxonomy(get_queried_object()->taxonomy);
             /* translators: 1: Taxonomy singular name, 2: Current taxonomy term */
             $title = sprintf(__('%1$s: %2$s'), $tax->labels->singular_name, single_term_title('', false));
         } else {
             $title = __('Archives');
         }
         return apply_filters('get_the_archive_title', $title);
     }, $html_safe);
     // wp_head
     $funcs[] = new Twig_SimpleFunction('wp_head', function () {
         ob_start();
         wp_head();
         $content = ob_get_clean();
         return $content;
     }, $html_safe);
     // wp_footer
     $funcs[] = new Twig_SimpleFunction('wp_footer', function () {
         ob_start();
         wp_footer();
         $content = ob_get_clean();
         return $content;
     }, $html_safe);
     // language_attributes
     $funcs[] = new Twig_SimpleFunction('language_attributes', function ($doctype = 'html') {
         return get_language_attributes($doctype);
     }, $html_safe);
     // get_option
     $funcs[] = new Twig_SimpleFunction('get_option', function ($option, $default = '') {
         return get_option($option, $default);
     }, $html_safe);
     // body_class
     $funcs[] = new Twig_SimpleFunction('body_class', function ($class = '') {
         return 'class="' . join(' ', get_body_class($class)) . '"';
     }, $html_safe);
     // post_class
     $funcs[] = new Twig_SimpleFunction('post_class', function ($class = '') {
         return 'class="' . join(' ', get_post_class($class)) . '"';
     }, $html_safe);
     // header_image
     $funcs[] = new Twig_SimpleFunction('header_image', function () {
         return get_header_image();
     }, $html_safe);
     // wp_list_categories
     $funcs[] = new Twig_SimpleFunction('wp_list_categories', function ($args = []) {
         $args['echo'] = false;
         return wp_list_categories($args);
     }, $html_safe);
     // wp_nav_menu
     $funcs[] = new Twig_SimpleFunction('wp_nav_menu', function ($args = []) {
         $args['echo'] = false;
         return wp_nav_menu($args);
     }, $html_safe);
     // the_id
     $funcs[] = new Twig_SimpleFunction('the_id', function ($args = []) {
         return get_the_ID();
     }, $html_safe);
     // the_date
     $funcs[] = new Twig_SimpleFunction('the_date', function ($id = null) {
         return get_the_date('', $id);
     }, $html_safe);
     // the_permalink
     $funcs[] = new Twig_SimpleFunction('the_permalink', function () {
         ob_start();
         the_permalink();
         return ob_get_clean();
     }, $html_safe);
     // the_post_thumbnail
     $funcs[] = new Twig_SimpleFunction('the_post_thumbnail', function ($id = null, $size = 'post-thumbnail', $attr = '') {
         return get_the_post_thumbnail($id, $size, $attr);
     }, $html_safe);
     // post_password_required
     $funcs[] = new Twig_SimpleFunction('post_password_required', function () {
         return post_password_required();
     }, $html_safe);
     // the_title
     $funcs[] = new Twig_SimpleFunction('the_title', function () {
         return get_the_title();
     }, $html_safe);
     // the_content
     $funcs[] = new Twig_SimpleFunction('the_content', function () {
         return get_the_content();
     }, $html_safe);
     // get_pagenum_link
     $funcs[] = new Twig_SimpleFunction('pagenum_link', function ($page = 1, $escape = true) {
         return get_pagenum_link($page, $escape);
     }, $html_safe);
     // paged_page
     $funcs[] = new Twig_SimpleFunction('paged_page', function () {
         return get_query_var('paged') ?: 1;
     }, $html_safe);
     // paged_pages
     $funcs[] = new Twig_SimpleFunction('paged_pages', function () {
         global $wp_query;
         return $wp_query->max_num_pages;
     }, $html_safe);
     // wp_link_pages
     $funcs[] = new Twig_SimpleFunction('wp_link_pages', function ($args) {
         $args['echo'] = false;
         return wp_link_pages($args);
     }, $html_safe);
     // edit_post_link
     $funcs[] = new Twig_SimpleFunction('edit_post_link', function ($text, $before, $after, $class) {
         ob_start();
         edit_post_link($text, $before, $after, 0, $class);
         return ob_get_clean();
     }, $html_safe);
     // the_field
     $funcs[] = new Twig_SimpleFunction('the_field', function ($field, $id = false) {
         return get_field($field, $id);
     }, $html_safe);
     // the_author_avatar
     $funcs[] = new Twig_SimpleFunction('the_author_avatar', function ($size = null, $id = null) {
         return get_avatar($id ?: get_the_author_meta('ID'), $size);
     }, $html_safe);
     // the_author
     $funcs[] = new Twig_SimpleFunction('the_author', function ($size = null) {
         return get_the_author();
     }, $html_safe);
     // the_author_link
     $funcs[] = new Twig_SimpleFunction('the_author_link', function ($size = null) {
         return get_the_author_link();
     }, $html_safe);
     // the_author_ID
     $funcs[] = new Twig_SimpleFunction('the_author_ID', function () {
         return get_the_author_meta('ID');
     }, $html_safe);
     // get_author_posts_url
     $funcs[] = new Twig_SimpleFunction('the_author_posts_url', function ($author_id = null, $author_nicename = '') {
         return get_author_posts_url($author_id, $author_nicename);
     }, $html_safe);
     // do_shortcode
     $funcs[] = new Twig_SimpleFunction('do_shortcode', function ($content) {
         return do_shortcode($content);
     }, $html_safe);
     // the_post_thumbnail
     $funcs[] = new Twig_SimpleFunction('the_post_thumbnail', function ($size = 'post-thumbnail', $attr = []) {
         ob_start();
         the_post_thumbnail($size, $attr);
         return ob_get_clean();
     }, $html_safe);
     // get_the_category
     $funcs[] = new Twig_SimpleFunction('the_category', function ($id = false) {
         return get_the_category($id);
     }, $html_safe);
     // get_category_link
     $funcs[] = new Twig_SimpleFunction('category_link', function ($id) {
         return get_category_link($id);
     }, $html_safe);
     // comments_number
     $funcs[] = new Twig_SimpleFunction('comments_number', function ($zero = '', $single = '', $many = '') {
         ob_start();
         comments_number($zero, $single, $many);
         return ob_get_clean();
     }, $html_safe);
     // comments_template
     $funcs[] = new Twig_SimpleFunction('comments_template', function ($file = '/comments.php', $seperate = false) {
         ob_start();
         comments_template($file, $seperate);
         return ob_get_clean();
     }, $html_safe);
     // get_comment_meta
     $funcs[] = new Twig_SimpleFunction('comment_meta', function ($id, $string = '', $single = false) {
         return get_comment_meta($id, $string, $single);
     }, $html_safe);
     // posts_pagination
     $funcs[] = new Twig_SimpleFunction('posts_pagination', function ($args = []) {
         return get_the_posts_pagination();
     }, $html_safe);
     return $funcs;
 }
/**
 * Helper function to build a newer/older or paginated navigation element within
 * a loop of multiple entries. This takes care of all the annoying formatting
 * which usually would need to be done within a template.
 *
 * This defaults to a pagination format unless the site is using a version of
 * WordPress older than 4.1. For older sites, we fall back to the next and
 * previous post links by default.
 *
 * @since  1.3.0
 * @access public
 * @param  $args array
 * @return string
 */
function flagship_get_posts_navigation($args = array())
{
    global $wp_query;
    // Return early if we're on a singular post or we only have one page.
    if (is_singular() || 1 === $wp_query->max_num_pages) {
        return;
    }
    $defaults = apply_filters('flagship_loop_nav_defaults', array('format' => 'pagination', 'prev_text' => sprintf('<span class="screen-reader-text">%s</span>', __('Previous Page', 'flagship-library')), 'next_text' => sprintf('<span class="screen-reader-text">%s</span>', __('Next Page', 'flagship-library')), 'prev_link_text' => __('Newer Posts', 'flagship-library'), 'next_link_text' => __('Older Posts', 'flagship-library')));
    $args = wp_parse_args($args, $defaults);
    $output = '';
    $output .= '<nav ' . hybrid_get_attr('nav', 'archive') . '>';
    $output .= sprintf('<span class="nav-previous">%s</span>', get_previous_posts_link($args['prev_link_text']));
    $output .= sprintf('<span class="nav-next">%s</span>', get_next_posts_link($args['next_link_text']));
    $output .= '</nav><!-- .nav-archive -->';
    if (function_exists('the_posts_pagination') && 'pagination' === $args['format']) {
        $output = get_the_posts_pagination(array('prev_text' => $args['prev_text'], 'next_text' => $args['next_text']));
    }
    return apply_filters('flagship_loop_nav', $output, $args);
}
<div class="clearfix"></div>
<?php 
$temp_query = $wp_query;
global $the_query;
//The query from the portfolio
if (isset($the_query)) {
    $wp_query = $the_query;
}
$pagination = get_the_posts_pagination(array('prev_text' => esc_attr__('Previous page', 'tography-lite'), 'next_text' => esc_attr__('Next page', 'tography-lite')));
if ($pagination) {
    echo '<div class="pagination_wrap">';
    echo wp_kses_post($pagination);
    echo '</div><!-- /pagination_wrap -->';
}
$wp_query = $temp_query;
wp_reset_postdata();
Exemple #23
0
/**
 * Wrap posts pagination.
 *
 * @see get_the_posts_pagination()
 *
 * @param array $args Pagination arguments.
 *
 * @return string
 */
function hw_posts_pagination($args = array())
{
    $args['type'] = 'list';
    return apply_filters('hw_posts_pagination', get_the_posts_pagination($args));
}
Exemple #24
0
                        include locate_template('archive-templates/right-50.php');
                    } else {
                        if ($layout == "image-right-33") {
                            include locate_template('archive-templates/right-33.php');
                        }
                    }
                }
            }
        }
        $i++;
    }
    echo $item_string;
    /** Restore original Post Data **/
    wp_reset_postdata();
    /** Custom query loop pagination **/
    $pagination = get_the_posts_pagination(array('mid_size' => 0, 'prev_text' => 'prev', 'next_text' => 'next'));
    /** Reset main query object **/
    $wp_query = NULL;
    $wp_query = $temp_query;
} else {
    /** no posts found **/
}
wp_reset_postdata();
if ($enabled_pagination == "Yes") {
    echo '<div class="next-text hidden">' . $next_text . '</div>';
    echo '<div class="prev-text hidden">' . $prev_text . '</div>';
    echo '<div class="page-nav-standard ' . $show_page_numbers_string . '">' . $pagination . '</div>';
}
?>
</div>
    echo get_template_directory_uri();
    ?>
/img/bye_prod.png" alt="bye_product"></a></span>
								</div>

								<?php 
}
?>
							<?php 
wp_reset_postdata();
?>

							</div>
						</div>
						<div class="row">
							<div class="col-xs-12 col-md-12">
							<!-- Пагинация -->
								<div class="paginations">
									<?php 
echo get_the_posts_pagination($args);
?>
								</div>
							</div>
						</div>
					</div>
				</div>	
				
			</div>
		</section>
<?php 
get_footer();
Exemple #26
0
 /**
  * Display navigation to next/previous set of posts when applicable.
  *
  * @since Twenty Fourteen 1.0
  *
  * @global WP_Query   $wp_query   WordPress Query object.
  * @global WP_Rewrite $wp_rewrite WordPress Rewrite object.
  */
 function kt_paging_nav()
 {
     global $wp_query, $wp_rewrite;
     // Don't print empty markup if there's only one page.
     if ($wp_query->max_num_pages < 2) {
         return;
     }
     echo get_the_posts_pagination(array('prev_text' => __('<i class="fa fa-angle-double-left"></i> Previous', THEME_LANG), 'next_text' => __('Next <i class="fa fa-angle-double-right"></i>', THEME_LANG), 'screen_reader_text' => ' ', 'before_page_number' => ''));
 }
Exemple #27
0
			<div class="photogrid">
				<div class="photogrid-sizer"></div>
				<?php 
    while (have_posts()) {
        the_post();
        ?>
					<?php 
        get_template_part('content');
        ?>
				<?php 
    }
    ?>
			</div>
			<div class="clearfix"></div>
			<?php 
    if (get_the_posts_pagination()) {
        ?>
				<ul class="pager">
				<?php 
        if (get_previous_posts_link()) {
            ?>
					<li class="previous"><?php 
            previous_posts_link();
            ?>
</li>
				<?php 
        }
        ?>
				<?php 
        if (get_next_posts_link()) {
            ?>
			<?php 
if (have_posts()) {
    ?>
				<ul class="article">
					<?php 
    while (have_posts()) {
        the_post();
        ?>
						<?php 
        get_template_part('content', 'home');
        ?>
					<?php 
    }
    ?>
				</ul>

				<?php 
    $igr_pagination = get_the_posts_pagination(array('mid_size' => 3, 'screen_reader_text' => 'pagination'));
    $igr_pagination = str_replace('<h2 class="screen-reader-text">pagination</h2>', '', $igr_pagination);
    echo $igr_pagination;
    ?>
			<?php 
}
?>
		</article>
	</div>
</div>
</div>

<?php 
get_footer();
/**
 * Display a paginated navigation to next/previous set of posts,
 * when applicable.
 *
 * @since 4.1.0
 *
 * @param array $args Optional. See {@see get_the_posts_pagination()} for available arguments.
 *                    Default empty array.
 */
function the_posts_pagination($args = array())
{
    echo get_the_posts_pagination($args);
}
Exemple #30
0
<nav>
	<?php 
$args = array('show_all' => False, 'end_size' => 1, 'type' => 'list', 'mid_size' => 1, 'prev_next' => True, 'prev_text' => '<span aria-hidden="true"><i class="fa fa-angle-left"></i></span>', 'next_text' => '<span aria-hidden="true"><i class="fa fa-angle-right"></i></span>', 'add_args' => False, 'add_fragment' => '', 'screen_reader_text' => 'XXX');
$nav = get_the_posts_pagination($args);
$nav = str_replace('<h2 class="screen-reader-text">XXX</h2>', '', $nav);
echo $nav;
?>
</nav>