Sort and display pages with specific custom field (not tag)

Thanks @PieterGoosen and @realloc. I came up with this solution: Added meta_key=important&meta_value=1 in wp_list_pages(). And gonna use custom field for pages important: 1. This is for list of IMPORTANT child pages. function important_list_child_pages() { global $post; if ( is_page() && $post->post_parent ) $childpages = wp_list_pages( ‘meta_key=important&meta_value=1&sort_column=menu_order&title_li=&child_of=” . $post->post_parent . “&echo=0’ ); else $childpages = wp_list_pages( … Read more

Check if the child page has sibling pages, and bookmark current page

Yes, it is possible: <?php global $post; $current_post = $post; if ( $post->post_parent ) { $siblings = new WP_Query( array( ‘post_type’ => ‘page’, ‘order’ => ‘ASC’, ‘post_parent’ => $post->post_parent ) ); } if ( $siblings->have_posts() ) : ?> <ul> <?php while ( $siblings->have_posts() ) : $siblings->the_post(); ?> <li><a href=”https://wordpress.stackexchange.com/questions/306078/<?php the_permalink(); ?>”> <?php if ( $current_post->ID … Read more

Get post and its children with WP_Query

The question that is similar to your question, i took sample code from there. you can replace ‘post_parent with this. global $post; $args = [ ‘wpse_include_parent’ => true, ‘post_parent’ => wp_get_post_parent_id( $post->ID ), ‘post_type’ => ‘post’ // Add additional arguments ]; $q = new WP_Query( $args ); This code will get the parents post id … Read more

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