-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtpl-page-lista-filhas.php
executable file
·64 lines (51 loc) · 2.37 KB
/
tpl-page-lista-filhas.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/*
Template Name: Página com listagem das filhas
*/
?>
<?php get_header(); ?>
<section id="main-section" class="col-8">
<?php if ( have_posts()) : while ( have_posts()) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class('clearfix');?>>
<header>
<?php if ($post->post_parent > 0): ?>
<?php $ancestors = get_post_ancestors($post->ID); ?>
<?php $ancestors = array_reverse($ancestors); ?>
<p class="bottom top">
<small>
<?php foreach ($ancestors as $ancestor): ?>
<a href="<?php echo get_permalink($ancestor); ?>"><?php echo get_the_title($ancestor); ?></a> :
<?php endforeach; ?>
</small>
</p>
<?php endif; ?>
<h1><?php the_title();?></h1>
</header>
<div class="post-content clearfix">
<?php edit_post_link('Editar', '', '' ); ?>
<?php the_content(); ?>
<?php $children = get_children('orderby=menu_order&order=ASC&post_parent='.$post->ID); ?>
<a name="index"></a>
<?php foreach ($children as $child): ?>
<h5 style="text-transform: none;"><a href="#<?php echo $child->post_name; ?>"><?php echo $child->post_title; ?></a></h5>
<?php endforeach; ?>
<hr />
<?php global $post; $old_post = $post; // precisamos disso para q todos os filtros do the_content funcionem?>
<?php foreach ($children as $child): ?>
<h5><a name="<?php echo $child->post_name; ?>"></a><?php echo $child->post_title; ?></h5>
<?php $post = $child; ?>
<?php echo apply_filters('the_content', $child->post_content); ?>
<a href="#index">[topo]</a>
<hr />
<?php endforeach; ?>
<?php $post = $old_post; ?>
</div>
</article>
<!-- .post -->
<?php endwhile; else : ?>
<p><?php _e('No results found.', 'SLUG'); ?></p>
<?php endif; ?>
</section>
<!-- #main-section -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>