File: /home/dwauav0tm6jp/hosted/joshcross_me/wp-content/themes/photographer-wp/template-portfolio.php
<?php
/*
Template Name: Portfolio
*/
?>
<?php
get_header();
?>
<?php
function pixelwars_portfolio_page__content_html()
{
while (have_posts()) : the_post();
$page_content = get_the_content();
if (! empty($page_content))
{
?>
<div class="layout-fixed">
<div class="entry-content">
<?php
the_content();
?>
</div> <!-- .entry-content -->
</div> <!-- .layout-fixed -->
<?php
}
endwhile;
}
function pixelwars_portfolio_page__content($location = 'Top')
{
$portfolio_page__content_location = get_option('pixelwars_portfolio_page_content', 'Top');
if ((($portfolio_page__content_location == 'Bottom') && ($location == 'Bottom')) ||
(($portfolio_page__content_location != 'Bottom') && ($location == 'Top')))
{
pixelwars_portfolio_page__content_html();
}
}
?>
<?php
function pixelwars_portfolio_page__departments_html()
{
$categories = get_categories(
array(
'taxonomy' => 'department',
'parent' => 0
)
);
foreach ($categories as $category)
{
?>
<div id="item-<?php echo esc_attr($category->term_id); ?>" class="masonry-item">
<figure>
<?php
$postslist = get_posts(
array(
'post_type' => 'portfolio',
'department' => $category->slug,
'posts_per_page' => 1
)
);
if ($postslist)
{
$featured_image_url = get_the_post_thumbnail_url($postslist[0]->ID, 'pixelwars_theme_image_size_760x507');
?>
<img alt="<?php echo esc_attr($category->name); ?>" src="<?php echo esc_url($featured_image_url); ?>">
<?php
}
?>
<figcaption>
<h2><?php echo esc_html($category->name); ?></h2>
<p><?php echo esc_html($category->description); ?></p>
<a href="<?php echo esc_url(get_category_link($category)); ?>"></a>
</figcaption>
</figure>
</div> <!-- .masonry-item -->
<?php
}
}
function pixelwars_portfolio_page__departments($location = 'top')
{
$portfolio_page__departments_location = get_option('pixelwars_portfolio_page__departments_location', 'top');
if ((($portfolio_page__departments_location == 'bottom') && ($location == 'bottom')) ||
(($portfolio_page__departments_location != 'bottom') && ($location == 'top')))
{
pixelwars_portfolio_page__departments_html();
}
}
?>
<div id="main" class="site-main">
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<?php
$pixelwars_hide_title = get_option(get_the_ID() . 'hide_post_title', false);
if ($pixelwars_hide_title != true)
{
?>
<div class="layout-full">
<header class="entry-header">
<h1 class="entry-title">
<?php
single_post_title();
?>
</h1> <!-- .entry-title -->
</header> <!-- .entry-header -->
</div> <!-- .layout-full -->
<?php
}
?>
<?php
pixelwars_portfolio_page__content($location = 'Top');
?>
<div class="layout-full">
<div class="media-grid-wrap">
<div class="gallery-grid">
<?php
pixelwars_portfolio_page__departments($location = 'top');
?>
<?php
$loop_portfolio = new WP_Query(
array(
'post_type' => 'portfolio',
'posts_per_page' => -1
)
);
if ( $loop_portfolio->have_posts() ) :
while ( $loop_portfolio->have_posts() ) : $loop_portfolio->the_post();
$the_terms = get_the_terms(get_the_ID(), 'department');
if ($the_terms == false)
{
?>
<div id="post-<?php the_ID(); ?>" <?php post_class('masonry-item'); ?>>
<figure>
<img alt="<?php the_title_attribute(); ?>" src="<?php the_post_thumbnail_url('pixelwars_theme_image_size_760x507'); ?>">
<figcaption>
<h2><?php the_title(); ?></h2>
<?php
$pf_short_description = stripcslashes(get_option(get_the_ID() . 'pf_short_description', ""));
?>
<p><?php echo $pf_short_description; ?></p>
<a href="<?php the_permalink(); ?>"></a>
</figcaption>
</figure>
</div> <!-- .masonry-item -->
<?php
}
endwhile;
endif;
wp_reset_postdata();
?>
<?php
pixelwars_portfolio_page__departments($location = 'bottom');
?>
</div> <!-- .gallery-grid -->
</div> <!-- .media-grid-wrap -->
</div> <!-- .layout-full -->
<?php
pixelwars_portfolio_page__content($location = 'Bottom');
?>
</div> <!-- #content .site-content -->
</div> <!-- #primary .content-area -->
</div> <!-- #main .site-main -->
<?php
get_footer();
?>