In my project, I want the parent page to display 3 child pages in its menu. Every child page will be different from product to product.

For example Product 1(Parent) 
 -Product 1
 -Product 2 

Each product will have the same template, I guess, but how can I display different child pages with the same name, since I dynamically load my child pages to the menu of the parent? Code to generate children :

<div class="col-md-12 product-navigation">

                if ($post->post_parent) {
                    $page = $post->post_parent;
                else {
                    $page = $post->ID;

                $children = wp_list_pages(array(
                    'child_of' => $page,
                    'echo' => '0',
                    'title_li' => ''

                if ($children) {
                    echo "<ul class='genProductList'>\n".$children."</ul>\n";

  • How are you creating and linking these child pages? Can we see your code so far? – Tom J Nowell Mar 24 '18 at 23:16
  • @TomJNowell i edited my post, check that! – Dimitris HD Mar 24 '18 at 23:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.