wordpress - Filtering portfolio with php -
i working on portfolio page , since don't want repeat code, have 1 database portfolio pieces. have 2 categories, work , freetime. both categories have own page. under these 2 categories, have couple subcategories. work has holland, england, germany , freetime has belgium, france , spain.
how can make sure when don't select subcategories freetime, portfolio item doesn't displayed under portfolio items in work , vice versa? (i hope question clear enough)
this code have atm retrieve portfolio database , use foreach loop loop through 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 $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 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 need more information me, let me know.
Comments
Post a Comment