I have read Using pre_get_posts with WP_Query and I'm not sure where to go with it.
I have a recent posts plugin which adds variables to WP_Query - one of which can be 'offset' posts. The problem is I have multiple instances of recent posts according to category and if I want an offset of 4 it offsets posts in the category rather than simply the latest 4 posts irrespective of category (I guess as part of
$args see code).
It feels like I need to filter the latest 4 posts from WP_Query before it is passed to recent posts but I'm not sure this is possible?
I've played with various snippets but haven't got anywhere. So far I am left with...
add_action('pre_get_posts', 'skips_front_page_filter'); $flexible_posts = new WP_Query( $args ); remove_action('pre_get_posts', 'skips_front_page_filter');
All I've done is surround
$flexible_posts = new WP_Query( $args ); with an action. Am I going about this the right way and can anyone assist me to strip the first 4 posts irrespective of category before it hits
There is a second part to this. I only want this filter to apply when my static front page is visible. I tried
if( is_front_page() ) but that hasn't helped although until I can get the filter working that's a secondary issue to worry about.
Would appreciate any help.