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

Automatic chage password of pages after some time

Welcome to WPSE. Plugin recommendations are considered off-topic here, so here’s an action approach to the problem. You could use WP Cron to schedule a daily event for resetting page password. You can use wp_schedule_event() to schedule your custom event. In your event callback, use first WP_Query with password parameter to get all protected pages. … 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

Swap home page based on user role, Elementor layout breaking

I do believe I’ve got it. Here’s the code: // Display different home page for dealer vs consumer if( is_user_logged_in() ) { $current_user = wp_get_current_user(); $user = new WP_User($current_user -> ID); if (in_array(‘Wholesale’, $user->roles)){ $page = get_post(2885); update_option( ‘page_on_front’, $page->ID ); update_option( ‘show_on_front’, ‘page’ ); } else { $page = get_post(2847); update_option( ‘page_on_front’, $page->ID ); … Read more