Custom page template for multiple pages

You can always make use of the page_template filter to tell WordPress to use a specific page template for all child pages of a certain parent. It is as easy as creating a special page template, lets call it page-wpse-person.php. Now it is as easy as including that template whenever a child page of people … Read more

Listing Child Pages in a Certain Order?

Based on your comments here is another option , using wp_list_pages and without having to work with arrays and pulling content manually, I’m leaving out a bunch of the options, just the bare essentials. <ul> <?php $priority_pages=”5,1,3,7″; wp_list_pages(array(‘include’ => $priority_pages); wp_list_pages(array(‘exclude’ => $priority_pages); ?> </ul> since, wp_list_pages, just gives you the <li> elements, you can … Read more

How to show child page without providing ID so it’s dynamic

//The correct code functions.php function get_page_parent_id( $id ) { $args = array( ‘sort_order’ => ‘ASC’, ‘sort_column’ => ‘menu_order’, ‘child_of’ => $id ); $args = get_pages($args); if(is_array($pages)) $pageID = $id; else { $pageID = wp_get_post_parent_id( $id ); } return $pageID; } ?> page.php <?php $parentID = get_page_parent_id(get_the_ID()); $childArgs = array( ‘sort_order’ => ‘ASC’, ‘sort_column’ => ‘menu_order’, … Read more

Create WordPress child page from page actions

If you mean the 404 error: function slt_childPageAction( $actions, $page ) { $actions[“create-child”] = ‘<a href=”‘.add_query_arg(array(‘post_type’ => ‘page’, ‘parent_id’ => $page->ID), admin_url(‘post-new.php’)).'” title=”Create a new page with this page as its parent”>Create child</a>’; return $actions; } add_filter( ‘page_row_actions’, ‘slt_childPageAction’, 10, 2 ); function slt_setChildPage() { global $post; if ( $post->post_type === ‘page’ && $post->post_parent === … Read more

Organizing Your Pages

I think you may be confusing parent pages (hierarchy) with page slugs (the URL). Parent pages are designed to allow you to programmatically build things like menus/submenus and breadcrumbs. Whereas a page slug is the visual representation in the URL. Many times, of course, I’d recommend you make your page slug match your hierarchy (for … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)