• Resolved chibib0

    (@chibib0)


    Hi,

    I have the following pages:
    Home 0
    Privacy 0
    Blog 0
    Contact us 0
    Store 0

    How to change page order programatically so that in the menu it will display according to this order,
    Home 1
    Blog 2
    Store 3
    Contact Us 4
    Privacy. 5

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • If your theme supports it, you can go to “Appearance > Menus” to put whatever links you want, in whatever order, in your menu. If your theme doesn’t support custom menus, you can edit each of those pages and put the number you want in the “Order” setting within the “Page Attributes” meta box.

    The only way to do it programmatically would be to create an array of pages in the order you want and then loop through the array to display the pages in the menu.

    However, that wouldn’t be advised because it makes administration a nightmare when pages are added or deleted. Your best bet is to either set the page order field when you’re adding or editing a page (you should see this on the right-hand side of admin page), or better yet, do as Big Bagel suggested and use the new Appearance->Menus to set up the menu structure.

    If you only have five pages, then trying to come up with programmatic solution would be overkill.

    Thread Starter chibib0

    (@chibib0)

    Thank you guys for your help.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to change page order programatically?’ is closed to new replies.