I’m not sure how plugin hooks would impact in any way the solution to your problem. The home.php
template file gets included at the template_redirect
action, which fires well-before wp_head
.
That said, what it sounds like you want to do is:
- Have
'posts_per_page' = 1
on the first page of the blog posts index - Have
'posts_per_page' = 10
on subsequent pages of the blog posts index
The simplest method is probably to use a static page as the site front page, and then use a custom query in front-page.php
to retrieve the latest post.
front-page.php
:
get_header();
$latest_post_args = array(
'post_per_page' = 1;
);
$latest_post = new WP_Query( $latest_post_args );
if ( $latest_post->have_posts() ) : while ( $latest_post->have-posts() ) : $latest_post->the_post();
// Loop markup goes here
endwhile; endif;
wp_reset_postdata();
get_footer();
Since is_singular()
returns true for static pages as the site front page, your plugin script enqueues should be unaffected.