target grandchildren (add style?) in get_pages list
-
Using get_pages to list all subpages is working well, but I’d like to style grandchild pages as clearly pages under their parent. Is there a way to add class like “parent” and “child” or something?
<?php //pull child page content in, remove parent post id to get all sub page levels $mypages = get_pages( array( 'child_of' => $post->ID, 'sort_column' => 'menu_order' ) ); foreach( $mypages as $page ) { $mycontent = $page->post_content; $mycontent = apply_filters( 'the_content', $mycontent ); ?>
results in all pages having the same styles
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘target grandchildren (add style?) in get_pages list’ is closed to new replies.