Title: Same posts in All pages
Last modified: August 31, 2016

---

# Same posts in All pages

 *  [vinn95](https://wordpress.org/support/users/vinn95/)
 * (@vinn95)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/same-posts-in-all-pages/)
 * Hi
    Same posts are displayed in all blog pages in my website.
 *     ```
       global $post;
       $page_id = $post->ID;
       $page_custom_fields = get_post_custom( $page_id);
   
       $page_sidebar_positioning = null;
       if (isset($page_custom_fields['page_sidebar_positioning'])) {
       	$page_sidebar_positioning = $page_custom_fields['page_sidebar_positioning'][0];
       	$page_sidebar_positioning = empty($page_sidebar_positioning) ? '' : $page_sidebar_positioning;
       }
   
       $section_class = 'full-width';
       if ($page_sidebar_positioning == 'both')
       	$section_class = 'one-half';
       else if ($page_sidebar_positioning == 'left' || $page_sidebar_positioning == 'right')
       	$section_class = 'three-fourth';
   
       $posts_per_page = get_option('posts_per_page');
   
       if ( get_query_var('paged') ) {
           $paged = get_query_var('paged');
       } else if ( get_query_var('page') ) {
           $paged = get_query_var('page');
       } else {
           $paged = 1;
       }
   
       $page = (get_query_var('paged')) ? get_query_var('paged') : 1;
       $args = array(
       	'paged'			   => $page,
       	'posts_per_page'   => $posts_per_page,
       	'offset'           => 0,
       	'category'         => '',
       	'post_type'        => 'post',
       	'post_status'      => 'publish'); 
   
       ?>
       ```
   
 * _[Moderator Note: Please post code between backticks or use the code button. 
   Your posted code may now have been damaged by the forum’s parser.]_
 * Any error in the above code. Please help me out as I am stumbling.
    Thanks in
   advance JassV

Viewing 1 replies (of 1 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/same-posts-in-all-pages/#post-7438319)
 * You get the same results from your custom query no matter what page number is
   requested because ‘paged’ and ‘offset’ arguments are incompatible together. Start
   with getting rid of ‘offset’ and ‘category’ arguments, they are not needed and
   can hinder you getting the right results.
 * If you still have trouble, it’s probably because the main query’s ‘paged’ argument
   is not appropriate for the custom query. It may be necessary to manage the custom
   query pagination completely separate from the main query, which means a different
   query var for custom query pagination and custom page links to match.

Viewing 1 replies (of 1 total)

The topic ‘Same posts in All pages’ is closed to new replies.

## Tags

 * [page](https://wordpress.org/support/topic-tag/page/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 1 reply
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [9 years, 11 months ago](https://wordpress.org/support/topic/same-posts-in-all-pages/#post-7438319)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
