-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcontent-portfolio.php
101 lines (83 loc) · 2.83 KB
/
content-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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
/**
* This template displays portfolio post content
*
* @package Portfolio Press
*/
if ( post_password_required() ) {
echo get_the_password_form();
} else {
// Set the size of the thumbnails and content width
$fullwidth = false;
if ( of_get_option( 'portfolio_sidebar' ) || is_page_template('full-width-portfolio.php') )
$fullwidth = true;
$thumbnail = 'portfolio-thumbnail';
if ( $fullwidth )
$thumbnail = 'portfolio-thumbnail-fullwidth';
// This displays the portfolio full width, but doesn't change thumbnail sizes
if ( of_get_option('layout','layout-2cr') == 'layout-1col' )
$fullwidth = true;
// Query posts if this is being used as a page template
if ( is_page_template() ) {
global $paged;
if ( get_query_var( 'paged' ) )
$paged = get_query_var( 'paged' );
elseif ( get_query_var( 'page' ) )
$paged = get_query_var( 'page' );
else
$paged = 1;
$args = array(
'post_type' => 'portfolio',
'posts_per_page' => 20,
'paged' => $paged );
query_posts( $args );
}
?>
<div id="coluna-direita">
<div id="portfolio"<?php if ( $fullwidth ) { echo ' class="full-width"'; }?>>
<?php if ( is_tax() ): ?>
<header class="entry-header">
<h1 class="entry-title"><?php echo single_cat_title( '', false ); ?></h1>
<?php // $categorydesc = category_description(); if ( ! empty( $categorydesc ) ) echo apply_filters( 'archive_meta', '<div class="archive-meta">' . $categorydesc . '</div>' ); ?>
</header>
<?php endif; ?>
<?php if ( have_posts() ) : $count = 0;
while ( have_posts() ) : the_post(); $count++;
$classes = 'portfolio-item item-' . $count;
if ( $count % 2 == 0 ) {
$classes .= ' ie-col3';
}
if ( !has_post_thumbnail() ) {
$classes .= ' no-thumb';
} ?>
<div class="<?php echo $classes; ?>">
<?php if ( has_post_thumbnail() ) { ?>
<a href="<?php the_permalink() ?>" rel="bookmark" class="thumb"><?php the_post_thumbnail( 'galeria' ); ?></a>
<?php } ?>
<a href="<?php the_permalink() ?>" rel="bookmark" class="title-overlay cont"><?php the_title() ?></a>
</div>
<?php endwhile; ?>
<?php /* Display navigation to next/previous pages when applicable */ ?>
<?php global $wp_query;
$total_pages = $wp_query->max_num_pages;
if ($total_pages > 1){
$current_page = max(1, get_query_var('paged'));
echo '<div class="page_nav">';
echo paginate_links(array(
'base' => get_pagenum_link(1) . '%_%',
'format' => 'page/%#%',
'current' => $current_page,
'total' => $total_pages,
'prev_text' => '<< Anteriores',
'next_text' => 'Próximos >>'
));
echo '</div>';
}
?>
<?php else: ?>
<h2 class="title"><?php _e( 'Sua pesquisa acabou sem resultados.', 'portfoliopress' ) ?></h2>
<?php endif; ?>
</div><!-- #portfolio -->
</div><!-- #coluna-direita -->
<?php } ?>
<?php get_footer(); ?>