Articles of get page

How to use get_page_by_title() with qTranslate?

Any idea how I can use the WP function get_page_by_title() with qTranslate installed? for example: $page_contact = get_page_by_title( ‘_e(“[:en]contact”);’ ,’page’ ); $page_contact_ID = $page_contact->ID; echo ‘~~~~’.$page_contact_ID; The only way I can get a match is by including the whole string with all the languages – and there is no way that’s going to work once […]

Sort “get_pages” by menu order not ordering

I’m using this bit of code to generate a page full of items but they won’t sort into the menu order, any ideas as to why? <?php $pages = get_pages(array(‘child_of’, ‘menu_order’)); ?>

get page title, url and excerpt of a page

I have the following setup: the front-page is setup as ‘static’ and it uses a theme page template. On this template / front-page, I need to get the page title, URL and excerpt of the About page. I found this code that does exactly what I need, but I’m wandering if there’s a different approach […]

Get only the grandchildren, not the direct children of page/current page?

I know javascript pretty well now but I am new to php and wordpress theme building. I have searched a fair bit and can’t find a solution to something that seems like a pretty simple task, all I would like to accomplish is get all the grandchildren of a page only, not the direct children, […]

Given the page id, check if it has children

I need to list subpages, given the id of parent one. I tried as follows: if ($children = get_pages(array(‘child_of’ => $post->ID)) && !empty($children)) { //Do stuff here } But this returns false anyways. I tried as well get_page_children($post->ID, array), but I think I didn’t really get how this function works. So, is it possible at […]

How to get the specific Page's current ID and use it in a get_page function?

Example of the code: $page_id = 116; // 123 should be replaced with a specific Page’s id from your site, which you can find by mousing over the link to edit that Page on the Manage Pages admin page. The id will be embedded in the query string of the URL, e.g. page.php?action=edit&post=123. $page_data = […]

get_pages() not ordering as it should

I’m using get_pages() function to get all subpages from a page like this: $childrens = get_pages(array(‘child_of’ => 7, ‘sort_column’ => ‘post_date’, ‘sort_order’ => ‘DESC’, ‘depth’ => -1)); This is supossed to get me a list of all pages (no matter if direct children, children of children, etc) orderen by the date they were created, but […]