<?php /* Template Name: Firma Ara */ ?><?php include(TEMPLATEPATH . '/header.php'); ?><?php wp_reset_query(); ?>
<?php the_title(); ?>
<?php $ilveilceler = get_terms( array('taxonomy' => 'ililce','hide_empty' => false, 'parent' => 0,) ); ?>
<?php $anasektorler = get_terms( array('taxonomy' => 'sektor','hide_empty' => false, 'parent' => 0,) ); ?>
<?php $il = $_GET['iller']; $ilce = $_GET['ilceler']; $anasektor = $_GET['anasektorler']; $altsektor = $_GET['altsektorler']; if($il == '' && $ilce == '' && $anasektor == '' && $altsektor == ''){ $il='hepsi'; $ilce='hepsi'; $anasektor='hepsi'; $altsektor='hepsi'; } $ilveilceler = array(); if($il == 'hepsi'){ $iller = get_terms( array('taxonomy' => 'ililce','hide_empty' => false, 'parent' => 0,) ); foreach($iller as $il){ $ilveilceler[] = $il->slug; } }else{ $ilveilceler[] = $il; if($ilce == 'hepsi'){ $ilceid = get_term_by('slug', $il, 'ililce'); $ilceler = get_terms( array('taxonomy' => 'ililce','hide_empty' => false, 'parent' => $ilceid->term_id) ); foreach($ilceler as $ilce2){ $ilveilceler[] = $ilce2->slug; } }else{ $ilveilceler[] = $ilce; } } $sektorler = array(); if($anasektor == 'hepsi'){ $sektorler2 = get_terms( array('taxonomy' => 'sektor','hide_empty' => false, 'parent' => 0,) ); foreach($sektorler2 as $sektor){ $sektorler[] = $sektor->slug; } }else{ $sektorler[] = $anasektor; if($altsektor == 'hepsi'){ $sektorid = get_term_by('slug', $sektor, 'ililce'); $altsektorler = get_terms( array('taxonomy' => 'ililce','hide_empty' => false, 'parent' => $sektorid->term_id) ); foreach($altsektorler as $sektor2){ $sektorler[] = $sektor2->slug; } }else{ $sektorler[] = $altsektor; } } $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1; $r = new WP_Query( array( 'posts_per_page' => 18, 'post_status' => 'publish', 'post_type' => 'thewpfirmarehberi', 'ignore_sticky_posts' => true, 'paged' => $paged, 'orderby' => 'date', 'order' => 'DESC', 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'sektor', 'field' => 'slug', 'terms' => $sektorler, ), array( 'taxonomy' => 'ililce', 'field' => 'slug', 'terms' => $ilveilceler, ), ) ) ); if ($r->have_posts()){ $firmalar = array(); foreach($r->posts as $key => $value){ $firmalar[$key]['id'] = $value->ID; $firmalar[$key]['title'] = $value->post_title; $firmalar[$key]['permalink'] = get_post_permalink($value->ID); if(wp_get_post_terms($value->ID, 'ililce', array("fields" => "names"))){ $ilveilceler = wp_get_post_terms($value->ID, 'ililce', array("fields" => "names")); if($ilveilceler[1]){ $firmalar[$key]['ililce'] = $ilveilceler[1] . ' / ' . $ilveilceler[0]; }else{ $firmalar[$key]['ililce'] = $ilveilceler[0]; } }else{ $firmalar[$key]['ililce'] = 'Belirtilmemiş'; } if(wp_get_post_terms($value->ID, 'sektor', array("fields" => "names"))){ $sektor = wp_get_post_terms($value->ID, 'sektor', array("fields" => "names")); if($ilveilceler[1]){ $firmalar[$key]['sektor'] = $sektor[1] . '/' . $sektor[0]; }else{ $firmalar[$key]['sektor'] = $sektor[0]; } }else{ $firmalar[$key]['sektor'] = 'Belirtilmemiş'; } $firmalar[$key]['image'] = wp_get_attachment_image_src(get_post_thumbnail_id($value->ID), 'resim5')[0]; } } if(!empty($firmalar)){ foreach($firmalar as $firma){ echo ''; } } ?>
<?php $pages = $r->max_num_pages; $showitems = (2 * 2)+1; if(1 != $pages) { echo "\n"; wp_reset_postdata(); } ?>
<?php include(TEMPLATEPATH . '/dosyalar/sagblok/populerfirmalar.php'); ?><?php include(TEMPLATEPATH . '/dosyalar/sagblok/gunlukHaberAkisi.php'); ?>
<?php include(TEMPLATEPATH . '/footer.php'); ?>