Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to get All Pages' slug
#1
How do I can get all the page-slug of every page I have created?

I want to get even the pages that were not added to the menu.

which function to use?
web design and internet marketing
Reply
#2
<?php
$data = menu_data();
print_r($data);
?>
- Chris
Thanks for using GetSimple! - Download

Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Reply
#3
<?php
$data = menu_data();
print_r($data);
?>

Can anyone write this code out to display as a Ul-Li list structure?

I'm little new to pHp ....thats why!
web design and internet marketing
Reply
#4
ccagle8 Wrote:<?php
$data = menu_data();
print_r($data);
?>

sure this works?
I only get the date of the current Page.
*******************
http://blog.projekt2k.de
*******************
Reply
#5
hello stilgarBF

I have tried that code is working . I tried by putting as a component.

It output an array of the details of the pages but i couldn't make it as a UL list.

If you can do try and let me know.
web design and internet marketing
Reply
#6
Kumar, after you get the array back, YOU have to loop through it and build the unordered list / menu structure. Here is how I did it. I created a functions.php file in my theme folder and included it in my theme. Next, I put this function in my functions.php file.

Code:
function getMenu() {

    $data = menu_data();
    $output = array();

    $output[] = '<ul>';
    foreach( $data as $menu) {
        $output[] = "<li><a href='" . $menu['url'] . "' title='" . $menu['title'] . "'>" . $menu['title'] . "</a></li>";
    }
    $output[] = '</ul>';

    $menu_string = implode("\n", $output);
    echo $menu_string;
}

In my theme file, I added
Code:
<?php getMenu();?>

This isn't the only way to do it or even the best way, but it worked for me.

Regards,

Brian
Reply
#7
Hai bnowell

Thanks for your update. I'll try it out right now and let me respond you.
web design and internet marketing
Reply
#8
this is similar to this post: http://get-simple.info/forum/viewtopic.php?id=105

the menu_data() function is still in it's infancy, and may change slightly from what is currently distributed with version 1.5. I would be cautious where you use this function because of that. This is the only function in this stage as it was added in 1.5 with no intention of it being used - i just accidentally mentioned it in one post, and now it has taken off...
- Chris
Thanks for using GetSimple! - Download

Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Reply




Users browsing this thread: 1 Guest(s)