Greetings! I'm Aneesh Sreedharan, CEO of 2Hats Logic Solutions. At 2Hats Logic Solutions, we are dedicated to providing technical expertise and resolving your concerns in the world of technology. Our blog page serves as a resource where we share insights and experiences, offering valuable perspectives on your queries.
Last day, we were working on a website in WordPress. The website contains few subpages and the client want the navigation for the subpages on the right side of the Web page. We had faced some difficulties to get it done. Finally, after a deep research we got a perfect solution for this and that has been mentioned below.
Paste this code where you want your subpage navigation and add subpages created under the main page.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | < ?php $children = wp_list_pages('depth=-1&title_li=&child_of=' . $post->ID . '&echo=0'); echo '<ul class="sub">'; if ($children) { echo $children; } elseif ($post->post_parent) { echo $children = wp_list_pages('depth=-1&title_li=&child_of=' . $post->post_parent . '&echo=0'); //echo '<li class="active">' . get_the_title() . '</li>'; } echo '</ul><ul>'; ?> </ul> |