File: /home/globfdxw/diasporameetsafrica.com/wp-content/themes/DA10/search/search-toggle-search-data.php
<?php
/*
* Theme: PREMIUMPRESS CORE FRAMEWORK FILE
* Url: www.premiumpress.com
* Author: Mark Fail
*
* THIS FILE WILL BE UPDATED WITH EVERY UPDATE
* IF YOU WANT TO MODIFY THIS FILE, CREATE A CHILD THEME
*
* http://codex.wordpress.org/Child_Themes
*/
if (!defined('THEME_VERSION')) { header('HTTP/1.0 403 Forbidden'); exit; }
global $CORE, $CORE_UI, $userdata, $Shownfilters;
?>
<div class="py-3">
<?php if(isset($GLOBALS['flag-taxonomy'])){
_ppt_template( 'search/search-breadcrumbs' );
}else{ ?>
<div class="container">
<nav ppt-nav class="seperator crumbs small pl-0">
<ul>
<li><a href="<?php echo home_url(); ?>" class="text-dark"><?php echo __("Home","premiumpress"); ?></a></li>
<li><a href="<?php echo home_url(); ?>/?s=" class="text-dark opacity-5"><?php echo __("Search","premiumpress"); ?></a></li>
</ul>
</nav>
</div>
<?php } ?>
<?php
// TITLE AFTER BREADCRUMS
// BUILD DISPLAY TITLE
$maintitle = str_replace("%s", __($CORE->LAYOUT("captions","2"),"premiumpress"),__("All %s","premiumpress"));
if(isset($GLOBALS['flag-taxonomy']) && in_array($GLOBALS['flag-taxonomy-type'],array("country","listing")) ){
$maintitle = str_replace("%e", $GLOBALS['flag-taxonomy-title'], str_replace("%s", __($CORE->LAYOUT("captions","2"),"premiumpress"),__("All %s in %e","premiumpress")));
}
?>
</div>
<div class="container _taxlistwrap">
<div class="row">
<div class="col-12">
<div class="_taxlist big mb-4">
<div>
<span <?php if(!isset($GLOBALS['darkmode'])){ ?>class="text-dark"<?php } ?>><?php echo $maintitle; ?></span>
<span class="float-right pl-4">
<a href="#" onclick="filterToggle('favs')" data-ppt-btn class="btn-system btn-sm mt-n3"><?php echo __("My Favorites","premiumpress"); ?></a>
<input type="hidden" class="toggle-favs" name="favorites" data-type="text" data-key="favorites" value="1" >
</span>
</div>
<ul>
<?php foreach(ppt_theme_toggle_search() as $k => $cat){ ?>
<li class="li-<?php echo $k; ?> <?php if(isset($cat['sort'])){ ?>li-sort<?php } ?>">
<a <?php if(isset($cat['sort'])){ ?> href="#" onclick="filterSortBy('<?php echo $k; ?>')" <?php }elseif(isset($cat['toggle'])){ ?> href="#" onclick="filterToggle('<?php echo $k; ?>')" <?php }else{ ?> href="<?php echo $cat['link']; ?>" <?php } ?>>
<?php echo $cat['name']; ?>
<?php if($k == "all"){ ?>
<b class="badge badge-pill text-light badge-primary"><strong class="ajax-search-found"></strong></b>
<?php }elseif(isset($cat['toggle']) && $k !="all"){ ?>
<strong class="addcount" data-countkey="<?php echo $k ; ?>-count"></strong>
<?php } ?>
</a>
<?php if(isset($cat['toggle'])){ ?>
<input type="hidden" class="toggle-<?php echo $k; ?>" data-type="text" data-key="<?php echo $k; ?>" value="1" >
<?php } ?>
</li>
<?php } ?>
</ul>
</div>
</div>
<?php
if(isset($GLOBALS['flag-taxonomy']) && in_array($GLOBALS['flag-taxonomy-type'],array("country","listing")) ){
$term = get_term_by('slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
$ThisTermID = $term->term_id;
$parent = $term->parent;
if($parent == "0"){
$parent = $term->term_id;
}
if($term->parent != 0){
$tlevel = 1;
$cats = get_terms( $taxonomy, array( 'hide_empty' => 0, 'parent' => $ThisTermID ));
if(empty($cats)){
$cats = get_terms( $taxonomy, array( 'hide_empty' => 0, 'parent' => $parent ));
$tlevel = 1;
}else{
$tlevel = 2;
}
}else{
$tlevel = 0;
$cats = get_terms( $taxonomy, array( 'hide_empty' => 0, 'parent' => $parent ));
}
if(!empty($cats)){
?>
<div class="col-12">
<div class="_taxlist">
<div><span class="text-primary">
<?php
if(isset($GLOBALS['flag-taxonomy']) && in_array($GLOBALS['flag-taxonomy-type'],array("country")) ){
echo str_replace("%s", $GLOBALS['flag-taxonomy-title'],__("Places in %s","premiumpress"));
}else{
echo str_replace("%s", $GLOBALS['flag-taxonomy-title'],__("More in %s","premiumpress"));
}
?>
</span></div>
<ul>
<?php
foreach($cats as $cat){ ?>
<li class="li-<?php echo $taxonomy; ?>-<?php echo $cat->term_id; ?> li-country">
<a href="#" onclick="UpdateSearchFieldToggleCountry('<?php echo $taxonomy; ?>-<?php echo $cat->term_id; ?>');" >
<?php echo $CORE->GEO("translation_tax_value", array($cat->term_id, $cat->name)); ?>
<span class="addcount" data-countkey="<?php echo $taxonomy; ?>-<?php echo $cat->term_id; ?>"></span>
</a>
<input
type="checkbox"
value="<?php echo $cat->term_id; ?>"
name="catid[]"
class="custom-control-input customfilter"
data-type="checkbox"
onclick="_filter_update()"
data-key="taxonomy"
data-value="<?php echo $taxonomy; ?>-<?php echo $cat->term_id; ?>"
<?php if(isset($GLOBALS['flag-taxonomy-id']) && $GLOBALS['flag-taxonomy-id'] == $cat->term_id){ echo "checked=checked"; } ?>>
</li>
<?php }
?>
</ul>
</div>
</div>
<?php
}// not empty
}
// TAXONOMY DATA
$Shownfilters =1;
$filters = ppt_theme_main_filters();
foreach( $filters as $f){
// DATA
$filter = $f['key'];
$title = $f['name'];
$type = "";
if(isset($f['type'])){
$type = $f['type'];
}
if(defined('WLT_DEMOMODE') && $filter == "tax_store"){
continue;
}
// HIDE
if(_ppt(array("searchfilter",$filter)) == "0" || (isset($GLOBALS['flag-taxonomy-type']) && $GLOBALS['flag-taxonomy-type'] == str_replace("tax_","",$filter) ) ){ continue; }
// TITLE
$title = SearchFilterCaptions($filter, $title);
if($type == "tax"){
$title = $CORE->GEO("translation_tax_key", str_replace("tax_","",$filter));
$title = SearchFilterCaptions($filter, $title);
}
if($type == "tax"){
// GET TERMS
$taxonomy = str_replace("tax_","",$filter);
$cats = get_terms( $taxonomy, array( 'hide_empty' => 0, 'parent' => 0 ));
?>
<div class="<?php if(count($cats) > 13 || $Shownfilters == count($filters)-1 ){ echo "col-12"; }else{ echo "col-6"; } ?>">
<div class="_taxlist">
<div><span class="text-primary"><?php echo $title; ?></span></div>
<ul>
<?php
foreach($cats as $cat){
?>
<li class="li-<?php echo $taxonomy; ?>-<?php echo $cat->term_id; ?>">
<a href="#" onclick="UpdateSearchFieldToggle('<?php echo $taxonomy; ?>-<?php echo $cat->term_id; ?>');" >
<?php echo $CORE->GEO("translation_tax_value", array($cat->term_id, $cat->name)); ?>
<span class="addcount" data-countkey="<?php echo $taxonomy; ?>-<?php echo $cat->term_id; ?>"></span>
</a>
<input
type="radio"
value="<?php echo $cat->term_id; ?>"
name="catid[]"
class="customfilter"
data-type="checkbox"
data-key="taxonomy"
data-value="<?php echo $taxonomy; ?>-<?php echo $cat->term_id; ?>" id="<?php echo $taxonomy; ?>-<?php echo $cat->term_id; ?>" style="display:none;" >
</li>
<?php } ?>
</ul>
</div>
</div>
<?php } ?>
<?php
$Shownfilters++;
}
?>
</div>
</div>
<script>
function filterToggle(val){
var toggleField = jQuery('.toggle-'+val);
var toggleFieldWrap = jQuery('.li-'+val);
if(val =="favs" && toggleField.hasClass('customfilter') ){
toggleField.removeClass("customfilter");
}else if(toggleFieldWrap.hasClass('active')){
toggleFieldWrap.removeClass('active');
toggleField.removeClass("customfilter");
}else{
toggleFieldWrap.addClass('active');
toggleField.addClass("customfilter");
}
_filter_update();
//SetMaxHeightlistingtogglesearch();
}
function filterSortBy(val){
jQuery(".li-sort").removeClass("active");
var toggleFieldWrap = jQuery('.li-'+val);
if(toggleFieldWrap.hasClass('active')){
toggleFieldWrap.removeClass('active');
}else{
toggleFieldWrap.addClass('active');
}
jQuery('#filter-sortby-main').addClass('customfilter');
jQuery('#filter-sortby-main').val(val);
_filter_update();
}
function UpdateSearchFieldToggleCountry(id){
jQuery('.li-country:not(.li-'+id+')').removeClass('active');
jQuery('.li-country .customfilter').removeClass('customfilter');
jQuery('.li-'+id+' .custom-control-input').addClass('customfilter');
var toggleFieldWrap = jQuery('.li-'+id);
if(toggleFieldWrap.hasClass('active')){
toggleFieldWrap.removeClass('active');
}else{
toggleFieldWrap.addClass('active');
}
var toggleFieldWrap = jQuery('.li-'+id+' input');
if(toggleFieldWrap.is(':checked')){
toggleFieldWrap.prop( "checked", false );
}else{
toggleFieldWrap.prop( "checked", true );
}
_filter_update();
SetMaxHeightlistingtogglesearch();
}
function UpdateSearchFieldToggle(id){
var toggleFieldWrap = jQuery('[data-value="'+id+'"]');
if(toggleFieldWrap.is(':checked')){
toggleFieldWrap.removeClass('customfilter');
jQuery('#'+id).prop( "checked", false );
}else{
jQuery('#'+id).prop( "checked", true );
toggleFieldWrap.addClass('customfilter');
}
var toggleFieldWrap = jQuery('.li-'+id);
if(toggleFieldWrap.hasClass('active')){
toggleFieldWrap.removeClass('active');
}else{
toggleFieldWrap.addClass('active');
}
_filter_update();
SetMaxHeightlistingtogglesearch();
}
jQuery(document).ready(function(){
jQuery("[ppt-nav]").removeClass("spacing");
});
</script>
<style>
._taxlist div {
position: relative;
<?php if(!isset($GLOBALS['darkmode'])){ ?>
background: linear-gradient(#eee, #eee) no-repeat;
background-size: 100% 1px;
background-position: 0 30%;
<?php } ?>
display: block;
padding-bottom: 10px;
}
._taxlist div span {
font-size: 14px;
align-self: center;
background:<?php if(isset($GLOBALS['darkmode'])){ echo "transparent"; }else{ echo "#fff"; } ?>;
text-transform:uppercase;
padding-right: 20px;
font-weight:600;
}
._taxlist ul {
flex-wrap: wrap;
display: inline-flex;
}
._taxlist ul li {
padding: 0px 15px 15px 0px;
min-width: 150px;
}
._taxlist ul li a { font-size:14px; text-decoration:none; font-weight:400; <?php if(isset($GLOBALS['darkmode'])){ echo "color:#fff"; }else{ echo "color:#333"; } ?> }
._taxlist ul li a span { color: <?php if(isset($GLOBALS['darkmode'])){ echo "#fff"; }else{ echo "#c9c9c9"; } ?>; font-size: 12px; font-weight: 600; }
._taxlist:not(.big) ul li a span .badge { margin-top:5px; line-height: 12px; float:left!important; margin-right:5px; }
._taxlist ul li.active a { font-weight:700; color:red; border-bottom: 1px dotted #000; }
._taxlist.big div { padding-bottom:20px; }
._taxlist.big div span { font-size:18px; font-weight: 800; }
._taxlist.big ul li a { font-size:16px; }
._taxlist.big ul li { min-width:16.5%; }
._taxlist.big ul li .badge { float:none!important; }
._taxlist.big ul li:nth-child(n+1):nth-child(-n+6) a {
font-weight:600;
}
._taxlist.big ul li:nth-child(n+7) a {
border-bottom: 1px dotted #000;
}
</style>
<input type="hidden" name="sort" class="customfilter" id="filter-sortby-main" data-type="select" data-key="sortby" value="<?php if(isset($_GET['sort'])){
if(in_array($_GET['sort'],array("expiry"))){ echo $_GET['sort']."-u"; }elseif(strpos($_GET['sort'], "-u") !== false){ echo $_GET['sort']; }else{ echo $_GET['sort']."-d"; } } ?>" />