How can I remove the next and previous links in a custom post type archive page, but only for that post type?
I know I could wrap any function in if ( get_post_type($post) == 'myposttype' ) {}
but I can’t find a solid snippet to remove the pagination.
I have tried a few solutions, this being one of them, but nothing is working. And yes, I did try removing them from my template. 🙂
Got it figured out…
While I did manually remove the next page links, CloudFlare’s cache was not playing nice.
This will visually remove it from the page (but the links will still be in the HTML):
Use the class on the tag to use a CSS selector to set the Next/Previoius link CSS to “display:none”
Easiest way: open your archives.php template (or index.php if no archives.php) and copy it over to a new template and name it “archives-{post-type-name}.php”, then open it and remove the pagination function.
You can add formatting to raw post content by applying the content filters directly to post_content ( add code to functions.php wordpress) :