This repository has been archived by the owner on Jul 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtemplate-portfolio.php
87 lines (71 loc) · 3.29 KB
/
template-portfolio.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
/**
* Template Name: Portfolio
*
* Template for the Portfolio page, which displays all children of the Portfolio page.
*
* @package Ampersand
* @since Ampersand 1.0
*/
get_header(); ?>
<div id="main" class="site-main portfolio-columns clearfix">
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<!-- If there is post content, show it -->
<?php if( have_posts() ) : while( have_posts() ) : the_post(); ?>
<?php $post_content = get_the_content(); ?>
<?php if ( $post_content ) { ?>
<div class="post-content">
<div class="post-text">
<?php
// The loop for the content of the portfolio page itself. Mute the post flair on this page.
if ( function_exists( 'post_flair_mute' ) )
post_flair_mute();
the_content();
if ( function_exists( 'post_flair_unmute' ) )
post_flair_unmute();
?>
</div><!-- .post-text -->
</div><!-- .post-content -->
<?php } ?>
<?php endwhile; endif; ?>
<?php wp_reset_postdata(); ?>
<!-- Get the portfolio pages -->
<div class="posts">
<?php
$global_posts_query = new WP_Query(
array(
'posts_per_page' => 5,
'paged' => get_query_var( 'paged' ),
'post_type' => 'page',
'key' => '_wp_page_template',
'meta_value' => 'template-portfolio-item.php',
'post_parent' => get_the_ID(),
)
);
// The loop for the portfolio items
if ( $global_posts_query->have_posts() ) : while( $global_posts_query->have_posts() ) : $global_posts_query->the_post();
?>
<article <?php post_class(); ?>>
<div class="portfolio-column-wrap clearfix">
<a class="portfolio-featured-image" href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'ampersand' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><span><?php the_post_thumbnail( 'portfolio-thumb' ); ?></span></a>
<div class="portfolio-column-text">
<h2><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
<div class="portfolio-column-text-excerpt">
<?php the_excerpt(); ?>
</div>
<a class="more-link" href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'ampersand' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php _e( 'Read More', 'ampersand' ); ?></a>
</div><!-- .portfolio-column-text -->
</div><!-- .post-content -->
</article><!-- .post -->
<?php endwhile; endif; ?>
<?php wp_reset_postdata(); ?>
</div><!-- .posts -->
<div class="index-navigation">
<div class="nav-previous"><?php next_posts_link( __( 'Older posts', 'ampersand' ) , $global_posts_query->max_num_pages ); ?></div>
<div class="nav-next"><?php previous_posts_link( __( 'Newer posts', 'ampersand' ), $global_posts_query->max_num_pages ); ?></div>
</div>
</div><!-- #content .site-content -->
</div><!-- #primary .content-area -->
</div><!-- #main .site-main -->
<?php get_footer(); ?>