Articles of child pages

Custom Field returning Numerical Value for Image rather than URL

I have been trying a way round my latest WordPress problem all morning and I feel now is the right time to shout and ask for help. I have been trying to create a people directory, I’m there except for the overall listing page which I have decided to be rows of 5 images followed […]

Load child template based on parent

I have child page templates that need to be automatically applied based on the parent template. I’m wondering if there is anyway WordPress handles this. This is the solution I came up with. (in page.php) <?php //Check parent template if ($post->post_parent != $post->ID ) { //Get parent template filename $parentTemplate = get_post_meta($post->post_parent,’_wp_page_template’,true); } switch ($parentTemplate) […]

WordPress pages with hierarchy

Is there a way of creating page hierarchy in WordPress? What I want to do is to organise my pages (not posts) into like-groups as in: In the sitemap snippet above, both contact and opening-hours fall under about as like-group. How can I effectively group my pages as described above?

inserting custom li class to wp_list_pages

I currently have a parent page with some child pages. I am able to list these child pages but would like to insert a custom li class. The wp_list_pages outputs <li class=”page-item number”></li>. I would like for it to output <li class=”hvr-underline”></li>. Here is the code I have so far: $children = wp_list_pages( ‘title_li=&child_of=’.$post->ID.’&echo=0′ ); […]

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 […]

meta_key & meta_value not working with get_pages and custom taxonomy

I’m trying to use custom taxonomy with pages. Basically a page has a “relevance” taxonomy, depicting who the page is relevant for. The pages are created in a hierarchy based on the departmental structure of the school district which the site is for. So say I’m on the alumni page, and I want to list […]

Add theme templates for child categories into the template hierarchy

in my site i have many category and subcategory (child category) say like my one category name Printing – 4 color – 2 color – offset print Exmple i want when visit 4 color category page it will show all 4 color category post with particular template. i tried many code but not is actually […]

get_posts() excluding all children of a specific post/page

I know how to use include and exclude parameters of the get_posts function but how do I tell get_posts to exclude a document and every child page under it ? I know that I could collect all the IDs of the child pages using get children() and then append an array of these in the […]

How to target children of child pages

I would like to apply special styling to the menu items of pages that are children of child pages. Is there a way to do this?

Show content if parent page has children

Using this piece of code you can show content depending if it’s a child-page or not: <?php global $post; if ( is_page() && $post->post_parent ) : ?> This is a child-page. <?php else : ?> This is a parent-page. <?php endif; ?> But I would like to add one more statement, so that I could […]