Can post_count be modified (incremented/decremented by user code)
-
In my (probably convoluted) way of using WP, I have a hierarchy of categories. Using “parent” categories, I display a normal “blog” but also use it for a newsletter archive and a front page (of the site…not the blog) displayer, etc. In my evolution to this usage of WP, I’ve created a situation whereby my posts per page number is getting a bit messed up. Let me explain.
In my category hierarchy, I have “blog categories” and they are the only ones that I want to show up on my “blog page”. On my blog page I want the posts per page setting to be respected. On any other page I control it explicitly with showposts and a very specific category limit.
So, I check which category something belongs to (its parent) before allowing it to disply, BUT that is WITHIN the Loop. So, the post_count is merrily decrementing whilst I say “no, don’t show that one, it has the wrong category parent…no not that one either”.
What I’d like to be able to do is to INCREMENT post_count if I find that I’ve excluded a post because of its category so that in the end I display the posts per page amount of the SELECTED posts. Right now, for example, I’ve written a bunch of newsletter (non-blog) posts but few blog posts. So, while I have a posts per page count of 10, only 2 show up before it says “next page”. It counted to 10 just fine but included all those newsletter posts with it.
Sorry to ramble, but if anyone knows a way to modify post_count in user code, that’s the bottom line question.
Thanks for any help!
The topic ‘Can post_count be modified (incremented/decremented by user code)’ is closed to new replies.