I am working on a portfolio page and since i don’t want to repeat the code, i have 1 database for all my portfolio pieces.
I have 2 categories, Work and Freetime. Both categories have their own page.
Under these 2 categories, i have a couple subcategories.
Work has Holland, England, Germany and Freetime has Belgium, France and Spain.
How can i make sure that when i don’t select any subcategories from Freetime, the portfolio item doesn’t get displayed under ALL portfolio items in Work and vice versa? (I hope my question is clear enough)
This is the code i have atm where i retrieve the portfolio database and use a foreach loop to loop through all the items:
<div id="container-portfolio" class="containerp">
<div id="effect-2" class="effects clearfix">
<?php
$portfolio_items = get_field('portfolio_items',165);
if($portfolio_items):
foreach($portfolio_items as $index => $item) :
$category_work = $item['category_work'];
$image = $item['image'];
$title = $item['title'];
$description = $item['description'];
$short_description = $item['short_description'];
$website = $item['website'];
$why = $item['why'];
$quote = $item['quote'];
$quotename = $item['quotename'];
$category_freetime = $item['category_freetime'];
?>
<div class="mix <?php print implode(' ', $category_work); ?>">
<div class="img">
<img src="<?php print $image; ?>" alt="<?php print $title; ?>" width="175" height="175">
<div class="overlay">
<a href="#" data-toggle="modal" data-target="#<?php print $title; ?>"
class="expand"><?php echo __('More Info..', 'info'); ?></a>
<a class="close-overlay hidden">x</a>
</div>
</div>
</div>
<div class="modal fade" id="<?php print $title; ?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" >
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">×</span><span class="sr-only">Close</span>
</button>
</div>
<div class="modal-body" style="text-align:center;">
<img src="<?php print $image; ?>" alt="<?php print $title; ?>" width="175" height="175">
<h1><?php print $title; ?></h1>
<p class="subTitle"><?php print $short_description ?></p>
<p class="description"><?php print $description; ?></p>
<p class="why">Why we love it</p>
<p class="whyText"><?php print $why; ?></p>
<hr class="portfolio_hr">
<p class="quoteText">“<?php print $quote; ?>”</p>
<p>– <?php print $quotename; ?></p>
<hr class="portfolio_hr">
<p><a href="http://<?php print $website; ?>" target="_blank">http://<?php print $website; ?></a></p>
</div>
</div>
</div>
</div>
<?php
endforeach; endif; ?>nter code here
If you need more information from me, let me know.