Author Archive Pagination with Types Plugin
-
Dear bro,
I am using Types plugin for a Vietnamese site. The problem is post display good in:
https://tamsao.com/blog/tvnguyen_tamsao_admin_2012_1452But return 404 page in page:
https://tamsao.com/blog/tvnguyen_tamsao_admin_2012_1452/page/2(I set up display 20 post per page)
I tried to modify add_action “pre_get_posts” but not effect.
function pre_custom_query( $query ) { global $ptlist; $found = false; $post_type = array(); if (strpos($current_url, '/blog/'.$curauth->user_nicename) !== false) { $found = true; foreach ($ptlist as $pt) { $post_type[] = strtolower($pt); } } else { foreach ($ptlist as $pt) { if (strpos($current_url, '/'.strtolower($pt).'/'.$curauth->user_nicename) !== false) { $found = true; $post_type[] = strtolower($pt); break; } } } // found an author page if ($found) { $query->set( 'post_type', $post_type ); $posts_per_page = get_query_var('posts_per_page'); if ($posts_per_page == '') { $posts_per_page = 20; } //get page number $pageindex = strpos($current_url, '/page/'); if ($pageindex !== false) { $paged = (int) substr($current_url,$pageindex+strlen('/page/')); } else { $paged = 1; } /*$query->set( 'paged', $paged ); $query->set( 'page', ''); $query->set( 'author_name', ''); $query->set( 'author', $author_id ); $query->set( 'is_single', false ); $query->set( 'is_archive', true ); $query->set( 'is_author', true ); $query->set( 'is_singular', false ); $query->set( 'posts_per_page', $posts_per_page );*/ $q = &$query->query; $q['paged'] = $paged; $q['post_type'] = $post_type; $q['page'] = ''; $q['author_name'] =''; $q['author'] = $author_id; $q['posts_per_page'] = $posts_per_page; } }
with
$ptlist = array('Video', 'Photo', 'Audio', 'Link', 'Quote', 'Article');
Appreciate all feedback.
Thank you very much,
Tien
Viewing 10 replies - 1 through 10 (of 10 total)
Viewing 10 replies - 1 through 10 (of 10 total)
- The topic ‘Author Archive Pagination with Types Plugin’ is closed to new replies.