我有超过5篇关于打字作业的帖子,但我的脚本只显示了5篇,我知道怎么了。
get_header ();
$args = array (
\'post_type\' => \'job\'
);
$myposts = get_posts ( $args );
if (! defined ( \'WP_ADMIN_DIR\' ))
define ( \'WP_ADMIN_DIR\', \'./wp-admin/\' );
?>
<div class="main-content-bg"></div>
<div class="main-content marg">
<div style="z-index: 1;">
<div
style="width: 100%; height: 100%; background-color: #fff; z-index: 2;">
<div class="top-show">
<?php
$top_success = false;
while ($top_success == false) {
$random_item = rand (0 , count($myposts) - 1);
$dwwp_stored_meta = get_post_meta ( $myposts[$random_item]->ID );
$date_from = str_replace ( ".", "-", $dwwp_stored_meta [\'date_from\'] [0] );
$date_to = str_replace ( ".", "-", $dwwp_stored_meta [\'date_to\'] [0] );
$now = time ();
$date_from = strtotime ( $date_from );
$date_to = strtotime ( $date_to );
$datediff_from = $now - $date_from;
$datediff_to = $now - $date_to;
$datediff_from = floor ( $datediff_from / (60 * 60 * 24) );
$datediff_to = floor ( $datediff_to / (60 * 60 * 24) );
if ($datediff_from >= 0 and $datediff_to <= 0) {
?> <img class="random_offer" id="<?php echo $myposts[$random_item]->ID; ?>" style="width:100%;" src="<?php echo WP_ADMIN_DIR . \'/kupony/\' . $myposts[$random_item]->ID . \'.png\' ?>"/>
<?php $top_success = true;
}
} ?>
</div>
<div class="top-strip"><img src="http://staudtuili.cal24.pl/wp-content/uploads/2015/11/top-strip.jpg" style="width:100%; visibility:hidden;"/></div>
<?php
try {
$search = sanitize_text_field($_GET["search_box"]);
} catch (Exception $e) {
$search = "";
}
global $post;
global $all_post_titles; // ?possibly needed//
$all_post_titles = array ();
$count = 0;
foreach ( $myposts as $post ) :
setup_postdata ( $post );
$dwwp_stored_meta = get_post_meta ( $post->ID );
$dwwp_stored_meta2 = get_post_meta ($dwwp_stored_meta[\'shop_id\'][0]);
$ajdi = $post->ID;
$date_from = str_replace ( ".", "-", $dwwp_stored_meta [\'date_from\'] [0] );
$date_to = str_replace ( ".", "-", $dwwp_stored_meta [\'date_to\'] [0] );
$now = time ();
$date_from = strtotime ( $date_from );
$date_to = strtotime ( $date_to );
$datediff_from = $now - $date_from;
$datediff_to = $now - $date_to;
$datediff_from = floor ( $datediff_from / (60 * 60 * 24) );
$datediff_to = floor ( $datediff_to / (60 * 60 * 24) );
if ($datediff_from >= 0 and $datediff_to <= 0) {
if (stripos($dwwp_stored_meta[\'name_id\'][0], $search) !== false or !$search<>""){
if ($count==0){
?>
<div class="items-table">
<div class="items-row">
<?php }?>
<div class="single-offer-uili" id="<?php echo $post->ID; ?>">
<a href="/kupon/?el_id=<?php echo $post->ID; ?>" target="_blank" style="color: #000; text-decoration:none;">
<div style="text-align:center;">
<div id="<?php echo $post->ID; ?>" style="position:relative; width: 98%; background-size:auto, cover; display: inline-block; margin-top:3px; background-image: url(\'http://staudtuili.cal24.pl/wp-content/uploads/2015/10/rabat_ol.png\'), url(\'<?php $text = $dwwp_stored_meta[\'image_url\'][0]; echo $text;?>\'); background-position: right bottom, center center; background-repeat: no-repeat;">
<img
id="<?php echo $post->ID; ?>" src="http://staudtuili.cal24.pl/wp-content/uploads/2015/11/dummy_it.jpg"
style="visibility: hidden; width: 100%;" />
<div
id="<?php echo $post->ID; ?>" style="right: 5px; bottom: 0px; position: absolute; color: #fff; font-size: 35px;"><?php $text = $dwwp_stored_meta[\'rabat_id\'][0]; echo $text;?></div>
</div>
</div>
<div
id="<?php echo $post->ID; ?>" style="height: 44px; display: table-cell; vertical-align: middle; text-align:left;">
<div id="<?php echo $post->ID; ?>" style="margin-left: 13px; margin-right: 13px">
<?php $text = $dwwp_stored_meta[\'name_id\'][0]; echo $text;?> - <?php $text = $dwwp_stored_meta2[\'name_id\'][0]; echo $text;?>
</div>
</div>
</a>
</div>
<!-- <img src="http://staudtuili.cal24.pl/wp-admin/kupony/?php echo $post->ID; ?>.png"></img> -->
<?php if ($count==2){
?>
</div>
</div>
<?php
}
$count = $count+ 1;
if($count >= 3){
$count = 0;
}
}}
endforeach;
如果($count!=0){对于($x=$count;$x<;3;$x++){?>
<div class="single-offer-uili" id="00">
<div id="00" style="position:relative; width: 98%; background-color: #252525; background-size:auto, contain; display: inline-block; margin-top:3px; background-image: url(\'\'), url(\'http://staudtuili.cal24.pl/wp-content/uploads/2015/11/dummy_rt.png\'); background-position: right bottom, center center; background-repeat: no-repeat;">
<img id="00"
src="http://staudtuili.cal24.pl/wp-content/uploads/2015/11/dummy_it.jpg"
style="visibility: hidden; width: 100%;" />
<div id="00"
style="right: 5px; bottom: 10px; position: absolute; color: #fff; font-size: 35px;"></div>
</div>
<div id="00"
style="height: 44px; display: table-cell; vertical-align: middle;">
<div id="00" style="margin-left: 13px; margin-right: 13px">Miejsce na Twoją zniżkę!</div>
</div>
</div>