generated from asuengineering/pitchfork-child
-
Notifications
You must be signed in to change notification settings - Fork 0
/
single-project.php
51 lines (36 loc) · 1.33 KB
/
single-project.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
<?php
/**
* The single project template for pitchfork-capstone. Starting point was the parent theme page.php.
* A block-first approach for page building.
*
* @package pitchfork-capstone
*/
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
get_header();
?>
<main id="skip-to-content" <?php post_class(); ?>>
<?php
while ( have_posts() ) {
the_post();
// get_template_part( 'templates-global/global-banner' );
// Parse through the blocks on the page.
// If an acf/hero block is in the #1 position, do nothing.
// Otherwise display the post title.
$content_blocks = parse_blocks( $post->post_content );
$first_block_names = array('acf/hero', 'acf/hero-video', 'acf/hero-post', 'core/post-title', 'acf/hero-capstone');
if ( ! in_array( $content_blocks[0]['blockName'], $first_block_names )) {
the_title( '<div class="page-title"><h1 class="entry-title">', '</h1></div>' );
}
the_content();
// Display the edit post button to logged in users.
if ( is_user_logged_in() ) {
echo '<footer class="entry-footer"><div class="container"><div class="row"><div class="col-md-12">';
edit_post_link( __( 'Edit', 'pitchfork' ), '<span class="edit-link">', '</span>' );
echo '</div></div></div></footer><!-- end .entry-footer -->';
}
}
?>
</main><!-- #main -->
<?php
get_footer();