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 6940973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:49:30+00:00 2026-05-27T12:49:30+00:00

I loaded wordpress page titles in top of my theme using get_pages() function like

  • 0

I loaded wordpress page titles in top of my theme using get_pages() function like a navigation menu:

<ul>
<?php $pages = get_pages('child_of=0&parent=0&echo=0'); 

   foreach($pages as $page){
     echo '<li class=pages id=menu_'.$page->ID.' >';
     echo $page->title;
     echo '</li>';
   }
?>
</ul>

Note:

  1. that the printed page titles doesn’t have link to the page.
  2. and all <li> tags have same class=pages
  3. and each <li> tag has an id related to current $page->ID

and I’ve used Jquery for call a function to show children of each page on click of each <li> tag with 2 last character of id attribute like below:

<script type=text/javascript>
  $(document).ready(function(){
    $('.pages').click(function(){
      var id = $(this).attr('id');
      id = id.substring(5,7);
      $('body').append(<?php get_pages('child_of=id&echo=1'); ?>);
    });
  });
</script>

Bu It doesn’t work, it seems the PHP block code called when page loaded.
Please help me to call the wordpress get_pages function on click event of each <li> to load children of pages.

  • 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-27T12:49:31+00:00Added an answer on May 27, 2026 at 12:49 pm

    Nobody is going to do this for you, but here are a few resources that may help you figure it out and lead you down the right path:

    Intro to AJAX:
    http://www.w3schools.com/Ajax/ajax_intro.asp

    Intro to AJAX (video):
    http://www.youtube.com/watch?v=tJXLRLDWjn4

    Everything you need to know about AJAX and how to use it with WordPress:
    http://codex.wordpress.org/AJAX
    Hint: follow the links under the “Developer Information” section.

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

Sidebar

Related Questions

I have developed a Wordpress site that loads pages dynamically using the .load function.
Is possible to have the posts loaded into an swf using the wordpress framework?
I'm using the jQuery Validation plugin with Wordpress to validate my contact page. I
I am using a simple ajax loader to get content on wordpress. $(#page_preview).load(ajaxloader/, function(response,
I'm using the WordPress attachment feature to allow end users of my theme to
When loaded a shared library is opened via the function dlopen() , is there
Say you've loaded a text file into a string, and you'd like to convert
For some reason wordpress randomly inserts blank paragraph tags on my page. I'm finding
Using wordpress 2.9.2. I am loading my css files for plugins as they are
I'm using wordpress with Smooth Gallery for showing featured news slider, and i want

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.