WordPress.org

Ready to get started?Download WordPress

Forums

WP-PageNavi
[resolved] Wp-pagenavi not working with page custom post_type (4 posts)

  1. victor_lee
    Member
    Posted 8 months ago #

    Demo http://thugianviet.net/phim-bo
    i using code

    <?php
    /*
    Template Name: Phim bộ
    */
    ?>
    <?php get_header();?>
        <!--/ Header -->
    <!-- Filter -->
            <div class="filter">
            <form method="get" action="/phim-le">
                <div class="content">
                	<div class="title_crum">
                        <span class="title_crum_end"><div class="sprites icons16 icon_blog"></div><h2><?php the_title();?></h2></span>
                    </div>
                    	<select name="sort_id" id="sort_id" tabindex="1">
                            <option value="">-Mặc định-</option>
    			<option value="date" >Mới nhất</option>
    			<option value="asc" >Cũ nhất</option>
    			<option value="title" >Tiêu đề phim</option>
                        </select>
                      <select name="country_name" id="quocgia_id" tabindex="1">
    								<option value="">-- Quốc gia --</option>
                                 <?php $qg = get_terms("quoc-gia");
    foreach ($qg as $selectqg) {
    if ($_GET["country_name"] == $selectqg->slug) { $selected = ' selected="selected"'; } else { $selected = ''; }
    echo '<option value="'.$selectqg->slug.'" '.$selected.'>'.$selectqg->name.'</option>';
    }
    							 ?>
    							</select>
    							<select name="y" id="namsx_id" tabindex="1">
    								<option value="">-Năm-</option>
    								<option value="2013">2013</option>
    								<option value="2012">2012</option>
    								<option value="2011">2011</option>
    								<option value="2010">2010</option>
    								<option value="2009">2009</option>
    							</select>
      <a href="/top-20-phim/" class="filter_link">Top 20</a>
      <a href="/phim-moi/" class="filter_link">Phim mới</a>
      <a href="/chieu-rap/" class="filter_link">Phim chiếu rạp</a>
    						<div class="item">
    							<input type="submit" class="filter_submit" value="Duyệt">
    						</div>
    					</form>
    				</div>
    				</div>
        <!-- / Filter -->
    <!-- Filter -->
    <!-- Main -->
        	<div class="main">
            	<div class="content">
                    <!-- Content main -->
                    	<div class="c_m">
                            <!-- Block new -->
                            	<div class="block_new">
                                	<div class="tabs" id="tabselect-2">
                                        <div id="list-wrap">
                                            <div id="tatca" class="tabs_content">
                                                <ul class="l_w_l">
    											<?php
    						$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    						$args=array(
    						'post_type' => 'post',
    						'meta_key'=>'phim_loai',
    						'meta_value'=>'phimbo',
    						'paged'=>$paged,
    						'post_status' => 'publish',
    						'showposts' => 20,
    						);
    						$my_query = null;
    						$my_query = new WP_Query($args);
    						while($my_query->have_posts()) : $my_query->the_post();?>
    						<?php get_template_part( 'loop', get_post_format() ); ?>
    						<?php endwhile;?>
                                                    <!-- Lay phim -->
                                                    <!-- End lay phim -->
                                                <?php wp_pagenavi( array( 'query' => $my_query ) );wp_reset_query(); ?>											</ul>
                                                <div class="clr"></div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            <!-- / Block new -->
                        </div>
                    <!-- / Content main -->
    <!-- End Main -->
     <!-- Sidebar -->
                    	<?php get_sidebar();?>
                    <!-- / Sidebar -->
    </div></div></div>
    <!-- footer -->
        		<?php get_footer();?>

    http://thugianviet.net/phim-bo/page/2
    eror 404

    https://wordpress.org/plugins/wp-pagenavi/

  2. Lester Chan
    Member
    Plugin Author

    Posted 8 months ago #

    Did you try to read through? Example: http://wordpress.org/support/topic/custom-post-type-pagination-not-working-2?replies=8#post-5424175

    And for static front page if you are using it you have to use page and not paged http://codex.wordpress.org/Function_Reference/get_query_var

  3. victor_lee
    Member
    Posted 8 months ago #

    I tried. Site remains 404

  4. Lester Chan
    Member
    Plugin Author

    Posted 8 months ago #

    You tried both links? Or one? I don't use custom post type myself but I know both link I pasted works for almost all custom post type.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.