• Good day guys.

    I am creating a custom slider gallery with AJAX using get_children() to display the images (as children of the page, just get the images from the gallery assigned to a page).
    The first time page loads without AJAX, just a get_children() call inside a page template.
    I have a $numberposts var for the quantity of images to be loaded and $offset to offset.

    When I use AJAX to get more images, and there are less than $numberposts left – for example, when in a gallery 48 images, the first time the first 32 are shown and when requesting more they are not received and WordPress says ‘0’.
    How this can be avoided?

    Also, could anyone tell me how can I remove WordPress response (-1, 0) from the HTML response?
    The script returns correct HTML (the one I need) along with a -1 in the end of it.

    Many thanks for help!

  • The topic ‘get_children dies when not enough elements left (AJAX)’ is closed to new replies.