Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom number post in category #69

Open
haianh1991 opened this issue Mar 18, 2020 · 0 comments
Open

Custom number post in category #69

haianh1991 opened this issue Mar 18, 2020 · 0 comments

Comments

@haianh1991
Copy link

haianh1991 commented Mar 18, 2020

I want show 100 post in a page of category id 192. But pagination is not working.

this is code in my file archive.php

<?php

better_amp_get_header();

better_amp_enqueue_block_style( 'archive' );

better_amp_template_part( 'views/archive/title' );

better_amp_show_ad_location( 'amp_archive_title_after' );
if (is_category('192')) {
    better_amp_template_part( 'views/loop/list-truyen' );
	better_amp_template_part( 'views/archive/pagination-truyen' );
}
else {
better_amp_template_part( 'views/loop/' . better_amp_page_listing() );

better_amp_template_part( 'views/archive/pagination' );
}


better_amp_get_footer();

this is code in my file list-truyen.php

<?php

better_amp_enqueue_block_style( 'listing', 'css/listing' );
better_amp_enqueue_block_style( 'listing-1', 'css/listing-1' );

?>
<div class="posts-listing posts-listing-1 test-cat-amp-truyen">
<?php
 // The Query
 $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
 $the_query = new WP_Query( array (
 'cat' => 192,
 'posts_per_page' => 100,
 'paged' => $paged,
 'max_num_pages' => 3
 
 ));
  
 if($the_query->have_posts()):
 // The Loop
 while ( $the_query->have_posts() ) : $the_query->the_post();?>
 <article <?php better_amp_post_classes( 'listing-item listing-1-item clearfix' ) ?>>

			<h3 class="post-title">
				<a href="<?php the_permalink() ?>" title="<?php the_title_attribute() ?>">
					<?php the_title() ?>
				</a>
			</h3>

		</article>
		<?php
 endwhile;
 endif;
 ?>
</div>

this is pagination.php

<?php

better_amp_enqueue_block_style( 'pagination' );

if ( is_rtl() ) {
	$prev = '<i class="fa fa-arrow-right" aria-hidden="true"></i>' . better_amp_translation_get( 'prev' );
	$next = better_amp_translation_get( 'next' ) . '<i class="fa fa-arrow-left" aria-hidden="true"></i>';
} else {
	$prev = '<i class="fa fa-arrow-left" aria-hidden="true"></i>' . better_amp_translation_get( 'prev' );
	$next = better_amp_translation_get( 'next' ) . '<i class="fa fa-arrow-right" aria-hidden="true"></i>';
}

the_posts_pagination( array(
	'mid_size'           => 0,
	'prev_text'          => $prev,
	'next_text'          => $next,
	'before_page_number' => '<span class="meta-nav screen-reader-text">' . better_amp_translation_get( 'page' ) . ' ',
	'after_page_number'  => ' ' . sprintf( better_amp_translation_get( 'page_of' ), better_amp_get_query()->max_num_pages ) . ' </span>',
) );

what i can to do custom category page?
Thank you for help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant