Kimlik doğrulama veya yönetimden onay bekliyor.
Aşağıda yer alan kodlarda otomatik olarak tüm basın ilan verileri geliyor after before kullanarak, ayrıca başlangıç ve bitiş tarihi seçildiğinde de ayıklayıp o tarih aralığına göre listeliyor. Benim yapamadığım uykusuz kalarak çözemediğim sorun aşağıdaki koda ne eklersem veya neyi değiştirirsem o günün tarihine ait sayfa açılır açılmaz veri gelebilir. Mesela o gün basın ilan veri yoksa gelmesi sadece tarih aralıkları seçildiğinde getiriyor zaten.
<?php include(TEMPLATEPATH . '/thewp/headerilan.php'); ?>
<?php
global $wpdb;
$tarih1 = isset($_GET['1tarih']) ? $_GET['1tarih'] : '';
$tarih2 = isset($_GET['2tarih']) ? $_GET['2tarih'] : '';
?>
<section class="top40">
<div class="ortala">
<div class="ilanFiltrele">
<form method="get">
<input name="1tarih" type="text" id="1tarih" placeholder="Tarih Seçiniz" <?php if($tarih1) echo 'value="'.$tarih1.'"'; ?> required>
<input name="2tarih" type="text" id="2tarih" placeholder="Tarih Seçiniz" <?php if($tarih2) echo 'value="'.$tarih2.'"'; ?> required>
<button name="ilanBul" id="ilanBul" type="submit" name="gonder" >Listele</button>
</form>
</div>
<div class="kategoriilanlar2">
<?php
$current_page = get_query_var('paged');
$current_page = max( 1, $current_page );
$per_page = get_option( 'posts_per_page' );
$offset_start = 0;
$offset = ( $current_page - 1 ) * $per_page + $offset_start;
$tema_ayarlar = get_option( 'yonetim_paneli' );
$ilan_cat = $tema_ayarlar['basinilanKatSec'];
$args = array(
'offset'=>$offset,
'posts_per_page'=> $per_page ,
'paged' => $current_page,
'cat' => array($ilan_cat),
'date_query' => array(
array(
'after' => $tarih1,
'before' => $tarih2.' 23:59',
'inclusive' => true,
),
),
);
$the_query = new WP_Query( $args);
$total_rows = max( 0, $the_query->found_posts - $offset_start );
$total_pages = ceil( $total_rows / $per_page );
if ( $the_query->have_posts() ) : $s=0;
while ( $the_query->have_posts() ) : $the_query->the_post(); $s++;
?>
<div class="liste">
<a target="_blank" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<figure>
<?php if (has_post_thumbnail()) {
vt_resize(get_post_thumbnail_id(), 365, 205, true);
} else {
echo '<img src="'.get_bloginfo('template_url').'/images/resmiilan.png" width="365" height="205"/>';
} ?>
</figure>
<time><?php the_time('d F Y'); ?> - <?php the_time('G:i'); ?></time>
<figcaption><?php the_title(); ?></figcaption>
</a>
</div>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
<?php else : ?>
<div class="ilanbulunmadi">
<strong>Seçtiğiniz tarihte uygun ilan bulunamadı!</strong>
<p>Farklı bir tarih aralığı seçerek yeni arama yapabilirsiniz.</p>
</div>
<?php endif; ?>
</div>
<div class="temizle"></div>
<?php theWPsayfala($total_pages,$current_page); ?>
</div>
</section>
<div class="temizle"></div>
<style>
.ilanbulunmadi {
position: relative;
padding: 30px 15px;
margin-bottom: 1rem;
border: 1px solid transparent;
color: #721c24;
background-color: #f8d7da;
border-color: #f5c6cb;
text-align: center;
}
.ilanbulunmadi strong {
font-size: 20px;
}
.ilanbulunmadi p {
font-size: 15px;
margin-top: 5px;
}
.ilanFiltrele {
width: calc(100% - 0px);
height: auto;
overflow: hidden;
display: block;
padding: 0px 0px;
position: relative;
z-index: 9;
text-align: right;
margin-bottom: 15px;
}
.ilanFiltrele input[type=text] {
width: calc(102px - 2px);
height: 44px;
line-height: 44px;
padding: 0px 15px;
margin: 0px 3px 0px 0px;
border: 1px solid #dedede;
-webkit-transition: 0.5s;
transition: 0.5s;
outline: none;
font-size: 14px;
font-weight: 300;
color: #747474;
display: inline-table;
}
.ilanFiltrele input[type=text]:focus {
border: 1px solid #dedede;
box-shadow: 0px;
}
.ilanFiltrele button#ilanBul {
width: auto;
height: 44px;
line-height: 44px;
overflow: hidden;
display: inline-table;
background-color: #585858;
cursor: pointer;
color: rgba(0, 0, 0, 0);
text-shadow: 0 0 0 #ffffff, 0 3rem 0 #ffffff;
transition: background-color 150ms, text-shadow 200ms;
font-size: 16px;
font-weight: 500;
border: 0px;
outline: none;
padding: 0px 30px;
margin-left: 2px;
}
.ilanFiltrele button#ilanBul:hover {
background-color: #d73516;
text-shadow: 0 -3rem 0 #ffffff, 0 0 0 #ffffff;
}
.datepicker input {
font-family: 'Roboto', sans-serif;
display:block;
border: none;
border-radius: 0.25rem;
border: 1px solid transparent;
line-height: 1.5rem;
padding: 0;
font-size: 1rem;
color: #607D8B;
width: 100%;
margin-top: 0.5rem;
}
.datepicker input:focus {
outline: none;
}
#ui-datepicker-div {
display: none;
background-color: #fff;
box-shadow: 0 0.125rem 0.5rem rgba(0,0,0,0.2);
margin-top: 0.25rem;
padding: 0.5rem;
z-index: 9999!important;
}
.datepicker table {
border-collapse: collapse;
border-spacing: 0;
}
.ui-datepicker-calendar thead th {
padding: 0.25rem 0;
text-align: center;
font-size: 0.75rem;
font-weight: 400;
color: #78909C;
}
.ui-datepicker-calendar tbody td {
width: 2.5rem;
text-align: center;
padding: 0;
}
.ui-datepicker-calendar tbody td a {
display: block;
line-height: 2rem;
transition: 0.3s all;
color: #666;
font-size: 0.875rem;
text-decoration: none;
}
.ui-datepicker-calendar tbody td a:hover {
background-color: #666;
color: #ffffff;
}
.ui-datepicker-calendar tbody td a.ui-state-active {
background-color: #d73516;
color: white;
}
.ui-datepicker-header a.ui-corner-all {
cursor: pointer;
position: absolute;
top: 0;
width: 2rem;
height: 2rem;
margin: 0.5rem;
border-radius: 0.25rem;
transition: 0.3s all;
}
.ui-datepicker-header a.ui-corner-all:hover {
background-color: #ECEFF1;
}
.ui-datepicker-header a.ui-datepicker-prev {
left: 0;
background: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5 vcmcvMjAwMC9zdmciIHdpZHRoPSIxMyIgaGVpZ2h0PSIxMyIgd mlld0JveD0iMCAwIDEzIDEzIj48cGF0aCBmaWxsPSIjNDI0Nzc wIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik03LjI4OCA2LjI5N kwzLjIwMiAyLjIxYS43MS43MSAwIDAgMSAuMDA3LS45OTljLjI 4LS4yOC43MjUtLjI4Ljk5OS0uMDA3TDguODAzIDUuOGEuNjk1L jY5NSAwIDAgMSAuMjAyLjQ5Ni42OTUuNjk1IDAgMCAxLS4yMDI uNDk3bC00LjU5NSA0LjU5NWEuNzA0LjcwNCAwIDAgMS0xLS4wM DcuNzEuNzEgMCAwIDEtLjAwNi0uOTk5bDQuMDg2LTQuMDg2eiI vPjwvc3ZnPg==");
background-repeat: no-repeat;
background-size: 10px;
background-position: 50%;
transform: rotate(180deg);
}
.ui-datepicker-header a.ui-datepicker-next {
right: 0;
background: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5 vcmcvMjAwMC9zdmciIHdpZHRoPSIxMyIgaGVpZ2h0PSIxMyIgd mlld0JveD0iMCAwIDEzIDEzIj48cGF0aCBmaWxsPSIjNDI0Nzc wIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik03LjI4OCA2LjI5N kwzLjIwMiAyLjIxYS43MS43MSAwIDAgMSAuMDA3LS45OTljLjI 4LS4yOC43MjUtLjI4Ljk5OS0uMDA3TDguODAzIDUuOGEuNjk1L jY5NSAwIDAgMSAuMjAyLjQ5Ni42OTUuNjk1IDAgMCAxLS4yMDI uNDk3bC00LjU5NSA0LjU5NWEuNzA0LjcwNCAwIDAgMS0xLS4wM DcuNzEuNzEgMCAwIDEtLjAwNi0uOTk5bDQuMDg2LTQuMDg2eiI vPjwvc3ZnPg==');
background-repeat: no-repeat;
background-size: 10px;
background-position: 50%;
}
.ui-datepicker-header a>span {
display: none;
}
.ui-datepicker-title {
text-align: center;
line-height: 2rem;
margin-bottom: 0.25rem;
font-size: 0.875rem;
font-weight: 500;
padding-bottom: 0.25rem;
color: #78909C;
}
.ui-datepicker-week-col {
color: #78909C;
font-weight: 400;
font-size: 0.75rem;
}
</style>
<script>
$( function() {
$( "#1tarih" ).datepicker();
} );
$( function() {
$( "#2tarih" ).datepicker();
} );
$( function() {
$( "#1tarih2" ).datepicker();
} );
$( function() {
$( "#2tarih2" ).datepicker();
} );
</script>
<?php include(TEMPLATEPATH . '/footer.php'); ?>