Structure for calling child pages
Structure for calling child pages
Structure for calling child pages
EDIT So if i understand correctly what you want is $children = get_posts( array( ‘parent’=> get_the_ID() )); // ‘post_type’ => ‘all_products’ in option Have you tried removing “parent”=>0, meaning that a page has no parent like this $children = get_pages( array( ‘child_of’ => $post->ID, ‘post_type’ => ‘svi_proizvodi’ ));
If you look at get_pages() in the Code Reference you’ll notice two parameters: sort_order and sort_column. So, the following example will give you child pages list sorted by menu_order: $pages = get_pages( array( ‘child_of’ => $post->ID, ‘post_type’ => ‘page’, ‘post_status’ => ‘publish’, ‘sort_column’ => ‘menu_order’, ‘sort_order’ => ‘desc’, ) ); You can change menu order … Read more
The third line of your code specifies the page post type by checking if is_page(). You can change that to is_singular(‘your-post-type’) so that it runs, then in your call to wp_list_pages() you also need to add a post_type argument so that that part of the code knows what to look for. So, to have this … Read more
You might need to get the about page’s ID and use that in your comparison: if ( is_page( ‘about’ ) || $about_page_id == $post->post_parent ) {
How do I list subpages in post editor view?
Use get_the_post_thumbnail_url() instead of wp_get_attachment_image_src() wp_get_attachment_image_src(): this function takes attachment id as first parameter
//Create an array containing the IDs of pages that are children of page ID XXX $args = array( ‘post_type’ => ‘page’, ‘post_parent’ => XXX, ‘fields’ => ‘ids’, ‘posts_per_page’ => -1, ); $qry = new WP_Query($args); //Convert the array into a string $string = implode(‘, ‘, $qry->posts); //Display the list of IDs – for testing purposes. … Read more
You need to work out what page level you are on first, so that you know the correct ID to pass to the child_of argument of wp_list_pages. Give this a try: global $post; $page_level = 0; $post_parent = null; // Work out what page level we’re on if($post->post_parent > 0) { $post_parent = get_post($post->post_parent); $page_level … Read more
I think there’s couple of ways doing this. 1) register_nav_menu, add your menu in Appearance > Menus to the registered menu location, then let wp_nav_menu handle the markup for you 2) register_nav_menu, add menu in Appearance > Menus, then use wp_get_nav_menu_items to get the menu items and write the html markup yourself. 3) Have an … Read more