• [ Moderator Note: Please post code or markup snippets between backticks or use the code button. ]

    $siteurl = get_option('siteurl');
    	global $post, $paged;
    	$data = '';
    	$temp = $wp_query;
      	$my_query2= null;
    	$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    	$my_query2 = new WP_Query( array( 'post_type' => 'portfolio',
    									 'paged' => $paged,
    									 'posts_per_page' => '10',
    								   )
    							);
    	while ( $my_query2->have_posts() ) : $my_query2->the_post();
    		$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'medium' );
    		$content = excerpt($post->post_content);
    		$data = '
    				<div class="grid_7 ports">
    					<div class="">
    						<img src="'.$image[0].'" style="border:solid 1px #ccc">
    						<p class="port-title">'.$post->post_title.'</p>
    						<p class="port-content">
    						'.$content.'
    
    						<a>ID.'" class="viewmore">view more..</a>
    						</p>
    
    					</div>
    				</div>
    				';
    		echo $data;
    	endwhile;
    	wp_pagenavi( array( 'query' => $my_query2 ) );
    	wp_reset_postdata();

    https://www.ads-software.com/extend/plugins/wp-pagenavi/

  • The topic ‘when i click page '2', it goes back to home page’ is closed to new replies.