Get custom field value from Grandparent Page for Parent and Child Pages

I’ve created the following pages and hierarchy: Grandparent Parent Parent Parent Child Child Child Parent Parent Grandparent The Grandparent pages have an ACF custom field to pick the colour. I’d like that colour selection to be applied for the Grandparent, Parent and Child pages. Within the loop, I’ve written the following code to grab the … Read more

Remove parent slug for child pages

I’m looking for a plugin/custom function that removes the parent slug of a child’s page permalink. Something that automatically changes the permalink for child pages. Example: www.blog.com/products/apple becomes www.blog.com/apple Anyone got a clue if that could be done? Thanks in advance 1 Answer 1 You may not like this answer, but it’s a quite simple, … Read more

Using pagination with get_posts on page type

Is there a way to use pagination on a page query like with posts? Here is the code I’m using: $listingPages = get_posts( array( ‘cild_of’ => ‘7’, ‘meta_key’ => ‘Type’, ‘post_type’ => ‘page’, ‘post_status’ => ‘publish’, ‘orderby’ => ‘meta_value’, ‘order’ => ‘ASC’, ‘posts_per_page’ => ’20’, ‘paged’ => ( get_query_var(‘paged’) ? get_query_var(‘paged’) : 1 ), ) … Read more

Display subpages under parent page as a list within a loop

I’m looking to make a page template, which, if the page is a parent of children pages, then display them as an ordered list. I would preferably like to do this as a loop. Any ideas, holler. Thanks. 1 Answer 1 First set your arguments(settings) $args = array( ‘post_parent’ => get_the_ID(), ‘post_type’ => ‘page’, ‘numberposts’ … Read more

Delete Child Posts

I’m trying to delete all child posts when the parent is deleted. The parent post deletes just fine, but the child posts are not properly deleting. Here’s the code I have in place now: $args = array( ‘post_parent’ => $parentid, ‘post_type’ => ‘custom-type’ ); $posts = get_posts( $args ); if ($posts) { // Delete all … Read more

How to display list of child pages of parent page in wordpress?

I have following format of menu. Treatment -Beauty –Services –Products -Surgery -washing I have followed follwed following link: How to Display a List of Child Pages For a Parent Page in WordPress But I do not want subpages of “Beauty” page. I want only “Treatment” Subpages. 2 Answers 2 Add this code to your functions.php. … Read more