Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6387489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:09:30+00:00 2026-05-25T03:09:30+00:00

I have a small jQuery menu setup on my site. When you click on

  • 0

I have a small jQuery menu setup on my site. When you click on a parent link it provides a smooth scrolling effect to display the sub pages.

I’m trying to find out how to keep the menu open whenever you’re viewing a subpage? Right now if you click Parent -> Subpage the new page will load with the whole menu closed. I want to keep the parent submenu open for all its child pages(I’m using WordPress if that matters). Would appreciate any help! Happy to clarify myself if need be.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T03:09:30+00:00Added an answer on May 25, 2026 at 3:09 am

    I’ve had this problem a while ago, but I didn’t use jquery. I think you can use this on you’re site. The idea is simple: show a div if you’re on a subpage.

    <?php
    global $wp_query;
    
    if( empty($wp_query->post->post_parent) ) {
    $parent = $wp_query->post->ID;
    } else {
    $parent = $wp_query->post->post_parent;
    } ?>
    <?php if(wp_list_pages("title_li=&child_of=$parent&echo=0" )): ?>
    <div id="show">
    <ul id="menu" class="black">
    <li><a href="http://www.myhomepage.com">Home</a></li>
    <?php wp_list_pages("title_li=&child_of=$parent" ); ?>
    </ul>
    </div>
    
    
    <?php endif; ?>
    

    Basically this script checks if you are on a page or on a sub-page. If you are on a sub-page it will show the div with id=”show”(the list of all subpages who have the same parent as the supage you’re currently on).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a small problem with a jquery click trigger. in my index.php i
I'm having a jquery issue with a small menu I have. I have a
I am building a small dropdown menu with jQuery, but i am have a
I have a small jQuery plugin that I use for form AJAX validation. There
I have a small jquery snippet that displays notification message at the top of
I have used JQuery for a small animation work: a table #photos contains 9
I have a page that uses jQuery with a small glitch. I managed to
I have a small problem with jQuery $.ajax() function. I have a form where
I am having a real headache. I have written a small and simple menu
Howdy. It's me again, and It's jQuery again. I have somthing like that: http://misiur.com/small/

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.