Parent page ID
-
Admin panel: Manage > Pages.
Look for the page title you want and the first column of the row is its ID.
This element disappeared in WP 2.5. So, where do I find the ID in this version?
It’s not there in v 2.6.2 either. Anyone know where we can find the Page ID now that it’s not in the Admin? And, no you can’t hover over the page title in Manage>Pages and have it show…
Simple solution (workaround): hover over the Page title and you will see the ID on the left bottom in the status bar.
Another workaround: install a plugin
https://www.ads-software.com/extend/plugins/reveal-ids-for-wp-admin-25/Not exactly sure what you want to do but here is
an if statement that will get the parent id of what ever
post is displaying and if that parent id is equal to zero
or the equalivent therof will get the id of current page..google dd-list-subpages.php. this is a plugin that allows you
to order and display sub pages of any page.. I made the parent
modification shown below in the generate function of this plugin
to display subpages of parent and if main parent page display its subpages.global $post;
global $wp_query;
if ($post->post_parent != 0){$thePostID = $post->post_parent;
}else{
$thePostID = $wp_query->post->ID;
}
All of the functions used here should already be loaded from index not template index, But Main Index..Don’t try and write preceeding code in just any page, prior to calling
index, wp-blog-header, wp-config,wp-settings and all of the includes that are in settings. I am not specifacly sure which file the actual functions used in this GET_PARENT exmple are in but an easy way to find them and see just how they work is to…Open visual studio select open file from file menu. Is your file dialog up yet? navigate to the includes folder in your wordpress package. Select All Files and click open. After the files have loaded press (ctrl f) you will get a search modal form there is a drop down box labeled Look In, select- All Open documents enter the function signature you are looking for press search. You will get more results if you only include the function name without ().
(IMPORTANT BACKUP) make sure to follow the full hierarchy and match up all functions if you decide to make a change anywhere.. WordPress as a similar structure for almost every function you use. If one function uses another function or class ensure all other functions that use that class can access it also making overloaded constructors and so forth are new to me in PHP but just be carefull…
I have noticed some functiones can be called in one page by a different name specifacly start_el of the walker_page class where you find the format output for page and post listings called by wp_list_pages(); you can modify the out put here.. It is a good idea to add a parameter to the default array lists in both wp_list_pages()
and walker_page class that allows you to specify your output type and then just do a case or if statement in start_el before generating list. this can be very neat little trick if you want moving and floating divs and stuffI know a little beond the scope of the question and TMI but it is good to find out the complete interworking of everything.
- The topic ‘Parent page ID’ is closed to new replies.