How to get an array of pages ID by some page’s slug and all its children pages in get_posts() function?

You can use get_page_by_path() to get a Page’s WP_Post object using its slug (ie, its path), and then use that object to then get the array of child page IDs using get_children(). // First we’ll create the list of posts (pages) to exclude. $exclude = array(); $parent_page_obj = get_page_by_path( ‘abc’ ); if ( ! empty( … Read more

Show children connected to parent pages

Add this to you theme, just after the title part that displays the title. <?php $args = array( ‘post_type’ => ‘page’, // Only get pages (attachments can be listed as children) ‘posts_per_page’ => -1, // List all the children ‘post_parent’ => $post->ID // Get pages that are the children of the current page ); $parent … Read more

Include parent page in list of child pages

You can get the parent with wp_get_post_parent_id(get_the_ID()), and store it in a new variable and do the same with the children and then just showcase them in any format you want. <?php $theParent = wp_get_post_parent_id(get_the_ID()); if ( $theParent->ID == 83 ) { ?> <div class=”parent”><?PHP echo get_the_title($theParent); ?></div> <ul class=”children”><?PHP wp_list_pages(array( ‘title_li’ => ”, ‘child_of’ … Read more

what does the symbol “?” mean and how can i edit that page?

? means the start of the variables that are accessable via PHP on the page called. The page https://www.testsite.com/ will be called, and booking variable will be accessible globally throughout the PHP script. In this case, the homepage script will be run. The $_GET[‘booking’] index will be set (to NULL), and will (usually) be accessible … Read more

Groping Pages Per Department Option

The easiest way is to add categories to pages. You can use a plugin for that: https://wordpress.org/plugins/add-category-to-pages/ Or if u are using a child theme, insert this code in functions.php in your child theme directory: function myplugin_settings() { // Add tag metabox to page register_taxonomy_for_object_type(‘post_tag’, ‘page’); // Add category metabox to page register_taxonomy_for_object_type(‘category’, ‘page’); } … Read more

Create page template

you must create a template in theme root directory like below and create a new page in wordpress admin dashboard and choose template from right menu like image below: my-page-template.php: <?php /* Template Name: MyTpl_1 */ ?> <?php // your logic goes here … ?> and choose it from menu while creating a new page: