Support » Requests and Feedback » PROBLEM: rearranging pages

  • Hi
    I have a theme I’m trying to edit. Frustratingly every time I publish a new page something in the code won’t let me rearrange the order of the pages after I’ve published them. I’ve even tried using page order plugins which seem to work in the admin but not on the live view.

    This is the code I’m talking about, at the end you’ll notice ‘order by ID’, even if i delete this it has no effect so what can I put instead that enables me to rearrange pages. This theme does not include wp_pages_list!

    $pages = $wpdb->get_results(“SELECT post_name, post_title, ID FROM $wpdb->posts WHERE post_type=’page’and ID < 303” order by ID);


Viewing 8 replies - 1 through 8 (of 8 total)
  • note: i am trying to include a certain number of pages in the top navigation. the last few published by function dissappear so I can put them in a sidebar with a widget.

    You don’t say “what order” you want to use, but changing the “order by ID” to “order by post_title” would change the order to alphabetic order. You could use “order by menu_order” if you wanted to use the value from the Order field (in Edit/Add Page) to determine the order.

    The “ID < 303” means you are excluding any post ID higher that 302.

    thanks michael,
    If i use menu_order is there a way to exclude certain pages from the nav instead of using < 303 or do I just delete this value and put menu_order?

    As if i delete this value all the pages will appear in my top nav which I want to avoid.

    Please help me im a bit of a novice and don’t understand how to configure the code. The nav dissappears completely when I put

    WHERE post_type=’page’and ID < 303″ order by menu_order);
    WHERE post_type=’page’and ID < menu_order);
    WHERE post_type=’page’and menu_order);

    I want 6 pages I choose appear in the nav

    $pages = $wpdb->get_results(“SELECT post_name, post_title, ID FROM $wpdb->posts WHERE (post_type=’page’ and post_status=’publish’ AND ID in (123,165,114)) ORDER BY menu_order”);

    Thanks so much it works like a dream!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘PROBLEM: rearranging pages’ is closed to new replies.