hello, I am very happy to use generate press for my projects, I have a question especially concerning the theme dispatch with the magazine grid.
I use this little function to remove the posts already published on my home page, keeping the main article in the grid magazine, but this does not work on my blog category page, can you direct me ?
//hide posts which have been displayed already
add_filter(‘post_link’, ‘track_displayed_posts’);
add_action(‘pre_get_posts’,’remove_already_displayed_posts’);
$displayed_posts = [];
function track_displayed_posts($url) {
global $displayed_posts;
$displayed_posts[] = get_the_ID();
return $url; // don’t mess with the url
}
function remove_already_displayed_posts($query) {
global $displayed_posts;
$query->set(‘post__not_in’, $displayed_posts);
}