Firstly, use WP_query
instead of query_posts
:
Secondly, for (static) pages use the variable ‘page’ (not ‘paged’).
$my_query = new WP_query( 'post_type=post&posts_per_page=5&paged=' .get_query_var('page') );
if ( $my_query->have_posts() ) while( $my_query->have_posts() ) :
$my_query->the_post();
the_title();
endwhile;
Related Posts:
- Do I need to use The Loop on pages?
- Is including the loop necessary for page.php? [duplicate]
- When and Why is is_singular(‘my_cpt’) true while in_the_loop() is false?
- loop not showing up when using a custom page template
- Custom page template
- Getting page ID inside loop
- Get Pagination (WP-PageNavi) not to work
- Loop and Page template : my WP_query don’t take args
- Create a loop that gets pages with their template
- Running a loop with a custom query string on a custom page template
- How to load all pages into one page with their templates
- Custom Loop Using Shortcode in Custom Page Template
- Do I need to use The Loop on pages?
- Page-loop is looping content from custom loops on the same site. How to avoid that?
- Multiple get_posts() queries on one page
- Print the whole page?
- excerpt not showing up
- Custom Header added within Dashboard pages, is this possible with custom template files?
- Duplicated tag in loop
- get the value for ALT is we check to see if an actual ALT value is set, if not we use the caption and if no caption is set we use the title
- My WordPress installation doesn’t load correct template
- get_template_part() to render single page Theme
- Display articles related to a custom field on a page
- Stuck with conflicting loops on page template
- Same Loop on Multiple Pages
- Custom Page Template and Category Exclusion
- Display all posts in a page code for template
- Jquery Slider for profile template
- Get excerpt using get_the_excerpt outside a loop
- Should I use loop in the single.php file?
- wp_list_categories: get latest featured_image of category
- WordPress Alphabetical Glossary close div in loop
- get_the_foo() in the loop – does it perform another query?
- Exclude filter on front page
- category__not_in — anyway to use category name instead of id?
- Filtering posts by multiple taxonomies
- Check if date of post is yesterday
- Exclude first 2 posts with meta_key from loop
- Make a custom loop inside single.php with pagination
- Why do I get `Call to a member function have_posts() on a non-object `? [closed]
- Help with Changing loop.php?
- How to split a loop into two columns
- Category Ajax call
- Change front-page layout after x amount of posts ( while in the same loop)
- Transient loop issue
- popular post weekly and monthly
- How can i use the same template file with a widget and category loop?
- WordPress Loop inside Loop?
- angularjs not displaying all posts
- Latest Post Styled Different Than other Posts
- ACF custom field in [closed]
- Split wordpress loop to multiple layouts
- Woocommerce: How to display product price [closed]
- Update status of all posts in a category
- is_active-sidebar loop
- Unable to change the “Read more” text inside the_excerpt
- Conditional: IF current user has NOT commented on current post (not including post author)
- Add “showing posts x to x of y” in custom post type paginated loop
- Change post order by meta key, per post basis
- Display a single category in blog section
- Query Nopaging action not having effect
- inserting content of 1 Post to in another with a template hierarchy
- Getting page slug
- How to get pagination to work with 2 wordpress loops
- How do i find and restore a sidebar that i accidentally deleted? [closed]
- Inserting CPT and static content at every X post, is this possible?
- loop through posts and display inserted media and post title as a link
- using update_user_meta to rank users
- Can’t grab author info outside of the loop
- Exceprt not displaying
- Add File Attachment Name and URL into Javascript
- How to tell if all posts are only in one category?
- How do I set the Stewart Search Template to return only published posts in the result
- Updating Post meta (ACF field) from Feed
- WordPress posts in the loop not stacking side by side
- How to separate post titles with a comma in the loop?
- get_posts changes main query
- Trying to get property ‘post_content’ of non-object
- WordPress loop : how to exclude some posts with their status?
- Homepage Loop Somehow Breaks Styling Of Post Grid
- Create an archive page(loop) for edd products (music files) with an audio player?
- Foundation modal in wordpress php loop
- Next 10 posts data of currently viewing post in blog page
- Have multiple loops on a page appear after/between page content
- How to fix pagination for custom loops?
- Get gallery and product gallery images full size
- trying to write a variable into a wp_query, need help!
- Home page loop with pagination problem
- WooCommerce custom loop pagination on front page
- Eliminate duplicates in a foreach loop [closed]
- Tag custom loop show posts
- While loop inside another while loop
- I want the first post on my home page to be lengthier than the rest (example included)
- Loop with Custom Post Type Taxonomies and Interstitial Code
- Question about custom plugin
- loop mix my child-category and parent-category
- Fix html inside a for loop [closed]
- How can you make it so the comment box shows on some pages or posts but not all?
- Insert multiple custom components after x-number of posts
- I make sticky post for my archive page for custom post type with ACF field and loop is not working