Support » Plugins » Hacks » looping through child pages of a single parent page

  • Hi,

    I’m trying to create a product page where the children pages are on the product’s landing page. I need a landing page which lists them all ie image, title, text etc.

    I went down the route of custom posts, but as there was no child/parent relationship with the main products page the sub navigation would not work as I need it to be dynamic. On top of that the site needs to be multilingual (hence the dynamic approach).

    I have been looking on the net and found this:

    function page_children($parent_id, $limit = -1) {
        return get_posts(array(
            'post_type' => 'page',
            'post_parent' => $parent_id,
            'posts_per_page' => $limit
    $page = page_children($post->ID);
    echo get_the_title($page);

    Even though it’s getting the correct parent ID it’s just looping through the news posts? Not the sub pages of products, which have been set up.

    Anyone know how I can do this? I need the title, feature image, and content in variables.

    Thanks in advance 🙂



  • The topic ‘looping through child pages of a single parent page’ is closed to new replies.