dj_q
Forum Replies Created
Viewing 3 replies - 1 through 3 (of 3 total)
-
Forum: Fixing WordPress
In reply to: WP_Query & pagination not workingTHANK kathatp.
But this work only in this private case.
If posts_per_page is change or delete word but with all Categories.I diggin in my head how to fix that because two of objects is not working proper. My decision is…
Put this in function.php
function my_posts_nav_link( $type = '', $label = '', $maxPageNum = '' ) { $args = array_filter( compact('type', 'label', 'maxPageNum') ); echo my_get_posts_nav_link($args); } function my_get_posts_nav_link($args = array()) { $return = ''; $defaults = array( 'maxPageNum' => '0', ); $max_num_pages = $args['maxPageNum']; $args = wp_parse_args( $args, $defaults ); $paged = get_query_var('paged'); if ( $max_num_pages > 1 ) { if ($args['type'] == "next") { $return = get_previous_posts_link($args['label']); } if ($args['type'] == "prev") { $return = my_get_next_posts_link($args['label'], $max_num_pages); } } return $return; } function my_get_next_posts_link( $label = 'Next Page »', $max_page = 0 ) { global $paged, $wp_query; if ( !$paged ) { $paged = 1; } $nextpage = intval($paged) + 1; if ( !is_single() && ( empty($paged) || $nextpage <= $max_page) ) { $attr = apply_filters( 'next_posts_link_attributes', '' ); return '<a href="' . next_posts( $max_page, false ) . "\" $attr>" . preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&$1', $label) . '</a>'; } }and call with
my_posts_nav_link('next','Newer',''.$queryObject->max_num_pages.'');Forum: Fixing WordPress
In reply to: paging and categoryEnd the second problem is solved.
Forum: Fixing WordPress
In reply to: paging and categoryThe first problem is solved.
For the second problem concerning any idea?
Viewing 3 replies - 1 through 3 (of 3 total)