function HomeSlider($attr) { $data = ''; $trips = servicedetail('', 'order by id asc'); if (count($trips) > 0) { $data .= '<div id="sequence"> <ul class="sequence-canvas">'; $cnt = 1; foreach ($trips as $trip) { $style = ''; if (file_exists("wp-content/uploads/serviceimages/" . $trip->beforeimage) && trim($trip->beforeimage) != '') { $img = get_option('home') . '/wp-content/uploads/serviceimages/' . $trip->beforeimage; //$data.='<style type="text/css">slide'.$cnt.'{background:url("wp-content/uploads/serviceimages/'.$trip->beforeimage.'") no-repeat center center fixed;}</style>'; /*?> <style type="text/css"> #sequence .slide<?php _e($cnt); ?>{background:url(wp-content/uploads/serviceimages/<?php _e($trip->beforeimage); ?>) no-repeat center center fixed;background-size:cover;} </style> <?php*/ } $data .= '<li> <div class="slidee slide' . $cnt . '" style="background:url(wp-content/uploads/serviceimages/' . $trip->beforeimage . ') no-repeat center center fixed;background-size:cover;"> <div class="pattern"> <div class="container home"> <div class="sixteen columns caption-three"><br /> <p>"' . $trip->detail . '"</p> </div> </div> </div> </div> </li>'; $cnt++; } $data .= '</ul></div><ul class="sequence-pagination">'; foreach ($trips as $trip) { $data .= '<li></li>'; } $data .= '</ul>'; } return $data; }
<?php global $wpdb, $signature; $prefix = $wpdb->base_prefix; $id = $_REQUEST['id']; $trip = servicedetail($id); $image = $trip[0]->image; if (file_exists("../wp-content/uploads/serviceimages/" . $image) && trim($image) != '') { unlink("../wp-content/uploads/serviceimages/" . $image); } $result = $wpdb->query("DELETE FROM `" . $prefix . "homeslides` where id='{$id}'"); if ($result == 1) { $url = get_option('home') . '/wp-admin/admin.php?page=HomeSlider&del=succ'; echo "<script>window.location='" . $url . "'</script>"; }