Consider this option of achieving what you seem to be requiring:
function wpse31701_filter_query() {
global $wp_query;
// Check year and month
if ( $wp_query->get( 'year' ) == 2005 and $wp_query->get( 'monthnum' ) == 5 )
// Check page number to apply offset
if ( $wp_query->get( 'paged') > 1 ) $wp_query->set( 'offset', 1 );
else $wp_query->set( 'posts_per_page', 1);
}
add_action( 'pre_get_posts', 'wpse31701_filter_query' );
Here we alter the query as soon as $the_query
is ready to get the posts, to modify the posts_per_page
to 1 if paged
is 1, and apply and offset of 1 post if paged
is > 1.
The important thing is to apply offset
and posts_per_page
; the rest is purely conditional so apply to taste.
Related Posts:
- What is the role and history of the $content_width global variable?
- Override parent theme translation on child theme
- What does exactly GPL license mean for my WordPress theme?
- Categorising themes by folders in backend
- Add a page outside of the current theme?
- How to create a live demo page for a theme? [closed]
- How to incorporate admin theme in my back-end-plugin
- Using chunk theme from wordpress.com on my own host
- What is the first file wordpress looks at in a theme?
- Duplicate and change a Theme Widget
- Custom Upload Panel in Menu Bar
- Two Navigation Menus in Themes Produce the same menus?
- WordPress themes under GPL license
- Theme not showing after uploading
- Being asked to update a theme that I don’t have
- I want to run different WordPress websites under the same database
- get_template_directory_uri does not seem to work when defining WP_CONTENT_DIR
- Using a _GET gives me a debug error (over my head)
- How can I create an “excerpt” with text that won’t be displayed in the post itself?
- Possible to put header-{your_custom_template}.php in subdirectory?
- Why wp_enqueue_style() not working?
- How to remove header image on subpages in Twenty Eleven (default theme)?
- Can I update themes without enabling maintenance mode?
- 404 Error while accessing the font files
- Child Style.css not overriding parent theme style located in assets/css/main.css
- Disable Theme API / Front end (for API only environment)
- Creating a theme options page
- Showing post thumbnail (attachment) on the archive.php category listing
- OptimizePress Theme Overriding add_filter page_template
- How do I change the scan depth for page template files?
- Moving test theme to live site without mySQL error – how? [closed]
- Add more widget areas to a theme
- Posts and Pages not showing on admin, but showing in theme
- Apache errors when retrieving taxonomies
- How can I add class to every quote element?
- wp_get_theme() works fine, but wp_get_themes() returns empty array
- Read More Button Not Responding To Click
- How to use command lines an activate theme in wp – cli also setup Vagrant/Sage Theme?
- Can’t resize logo in responsive theme?
- How to change the format of posts on the hompage?
- How to display message (with switch_theme hook) after deactivating My theme?
- GPL 2 Theme using a framework for commercial Theme?
- Using twitter bootstrap in a theme
- Featured images, am I missing something?
- Is there a way to upgrade a theme without losing custom templates?
- What hook is the currently active theme’s functions.php file loaded on? [duplicate]
- It’s okay if I do not write add_action()
- Basic Theme for a Static Corporate Website?
- WordPress 5.1 upgrade has lost the parent theme JavaScript
- SOLVED Custom Add rewrite rule and Get string
- Section Background Images?
- Theme update deleted my custom page
- Create page options for theme?
- Homepage showing a simple listing of title, featured image, then posted on
- Permissions error
- Where is the best place to catch useragent?
- Setting a new default template for the creation of a page
- How can I change the prev / next buttons text to Dutch?
- Event Organiser breaks the theme [closed]
- Get data from Theme Options and use them into meta options field in custom post type
- How to remove the tripadvisor logo from the wordpress theme?
- Can’t see themes for Multi-site wildcard subdomain
- Twenty Eleven NOT valid
- First click to blog title does not open the blog article
- Why does an ad page open when I browse my websites’s wp-admin page?
- Get the name WordPress default theme in the core
- Trying to revive an old wordpress site, but newer versions of wordpress install a different db structure
- What is the correct way to set up a staging server and use github for version control?
- How do I use the default style for widget?
- WordPress fails to embed video URL on specific theme
- Unable to set social icons using Advance Portfolio Theme
- How to add extra custom social icons to page with same style?
- Theme translation not working
- How can I theme or style the lost password page without a plugin?
- How to change allowed attachment files extensions
- how make wp include urls as https?
- how to costume title single page
- Transfer WordPress site to another domain
- Where can I find a theme that has a big banner
- WP-CLI wp theme install url PCLZIP_ERR_BAD_FORMAT (-10) : Unable to find End of Central Dir Record signature
- Site broken after deleting inactive themes [closed]
- Why Underscores Theme Comment Form Reversed?
- Featured images are cropped on index and post page
- Change theme’s thumbnail to cropped WP featured image
- How can i limit wordpress post title characters in sidebar?
- Stylesheet not being loaded? [closed]
- is it possible to create a website with wordpress with these requirements without coading?
- Theme making direct ajax calls to theme folder
- How to add sidebar to homepage programmatically?
- How to remove header “ish” label [closed]
- Where can I decide the number of posts to display on the blog index page?
- I need to disable responsive feature of a theme called Meet GavernWP [closed]
- how to add dynamic footer credit in Greatmag theme [closed]
- Twenty Fifteen Premium Theme [closed]
- Can i Remove copyright text wordpress.org theme
- Is it possible to dynamically show different themes for different users? [duplicate]
- Why does WP theme not look like promoted? [closed]
- Remove image next to header image on WellExpo theme [closed]
- How do I get rid of the Mindblown and the book recommendations?
- Adding PHP code to single template in 2023 edition of WordPress theme