Timeline for Exclude certain post formats from pagination
Current License: CC BY-SA 4.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 29, 2019 at 10:11 | answer | added | nmr | timeline score: 0 | |
Apr 29, 2019 at 9:59 | vote | accept | user10980228 | ||
Apr 29, 2019 at 9:21 | answer | added | Alexander Holsgrove | timeline score: 0 | |
Apr 29, 2019 at 9:09 | comment | added | Sally CJ |
No wonder the pagination also counts the gallery posts - you use if($format != 'gallery') to visually exclude the posts. You should use the pre_get_posts hook, or create a new WordPress query ($query = new WP_Query(...); ) to exclude the posts and have the correct pagination output.
|
|
Apr 29, 2019 at 9:06 | comment | added | user10980228 |
@SallyCJ, tried what you said about putting it straight after wp_reset_query() but still have same result <?php wp_reset_postdata(); echo paginate_links(); ?>
|
|
Apr 29, 2019 at 8:59 | comment | added | user10980228 | @SallyCJ, thanks for your response. I have updated my question with how I am displaying the posts | |
Apr 29, 2019 at 8:58 | history | edited | user10980228 | CC BY-SA 4.0 |
added 933 characters in body
|
Apr 29, 2019 at 8:56 | comment | added | Sally CJ |
It all depends on your WordPress query. I.e. paginate_links() may not be using the query where you've applied this: "I have excluded all the gallery posts from the index.php". So if it's the main query, you could try wp_reset_query(); echo paginate_links(); . And in the updated question, that args is for the WP_Query class and not the paginate_links function.
|
|
Apr 29, 2019 at 8:52 | history | edited | user10980228 | CC BY-SA 4.0 |
added 459 characters in body
|
Apr 29, 2019 at 8:41 | history | asked | user10980228 | CC BY-SA 4.0 |