• Hi all,

    I want to put the latest pages on my home-page, and I tried to do that with get_pages(). It works fine, except that some of the pages have no content. How can I tell get_pages not to return them? I need only 4 pages.

    Of course I can retrieve them all, then filter them with $page->post_content, but that seems a waste of resources to me (and therefore of speed).

Viewing 4 replies - 1 through 4 (of 4 total)
  • Do you want to show 4 specific Pages?

    Thread Starter Ooypunk

    (@ooypunk)

    Not very: the 4 newest. I do that now by sorting: post_date => DESC.

    If your display is going to hinge on whether these posts have content, I don’t think you have much option but to pull in more than 4 posts (say 8?) and then test for $post->post_content in the display loop. If it’s null, skip to the next loop iteration.

    Thread Starter Ooypunk

    (@ooypunk)

    I was afraid you were going to say that.

    Well, thanks anyway. ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘get_pages returning pages with no content’ is closed to new replies.