I'm looking for a function that evaluates whether a User has written any pages. have_posts() works great for posts, but doesn't work for pages...
I'm looking for a function that evaluates whether a User has written any pages. have_posts() works great for posts, but doesn't work for pages...
Pages are posts. have_posts() will work for both of them.
However, neither one will "evaluates whether a User has written any pages". You could use the get_pages() function and pass in an authors= parameter to get the pages by that author though.
Do you know what get_pages($authID) returns if the user has written no pages? I have a sub-section that I want to hide if get_pages returns some kind of 0 or 'false'. There is very limited documentation on this function
Yes, it is rather poorly documented.
Basically, it returns an array of the pages in question. Takes lots of possible parameters.
Try something like this:
if (empty(get_pages("author=".$authID))) {
// no pages for authID
}Perfect. Thank you!
This topic has been closed to new replies.