Last active
May 5, 2022 13:47
-
-
Save taciara/2a3245595b459f7057a42885139cc6f8 to your computer and use it in GitHub Desktop.
Puxar as páginas filha da página atual. Mas se não tiver filhas, puxar as irmãs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$args = array( | |
'post_type' => 'page', | |
'posts_per_page' => -1, | |
//'post_parent' => $post->ID, | |
'post_parent' => $post->post_parent, | |
'order' => 'ASC', | |
'orderby' => 'title' | |
); | |
$child = array( | |
'post_type' => 'page', | |
'posts_per_page' => -1, | |
'post_parent' => $post->ID, | |
//'post_parent' => $post->post_parent, | |
'order' => 'ASC', | |
'orderby' => 'title' | |
); | |
$parent = new WP_Query( $args ); | |
$childs = new WP_Query( $child ); | |
if ( $parent->have_posts() ) : | |
?> | |
<ul id="parent-<?php the_ID(); ?>" class="parent-page section-menu-page"> | |
<?php while ( $parent->have_posts() ) : $parent->the_post(); ?> | |
<li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></li> | |
<?php endwhile; ?> | |
</ul> | |
<?php if ( $childs->have_posts() ) :?> | |
teste | |
<?php endif; wp_reset_postdata(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment