|
|
|
อยากให้ช่วยแนะนำแนวทางแก้ไขว่าจะแก้ไขได้อย่างไรครับ |
|
|
|
|
|
|
|
ปันหาคือ ผมต้องการให้ส่วนยืนยันตกลง หลังจากกดแล้วเด้งไปหน้าใหม่ ที่จะทำคำว่าขอบคุนที่ลงประกาศ สามารถดูประกาศได้ แบบนี้ จะแก้ไขจากโค๊ดนี้ยังไงครับ พอกดบันทึกแล้วมันอยุ่ที่หน้าเดิมครับ ขอรบกวนชี้แนะหน่อยนะครับ
<?php
// if ( isset($_REQUEST['message']) && ($_REQUEST['message']=="ok")){
// $user_login = stripslashes($current_user->user_login);
// $user_email = stripslashes($current_user->user_email);
// $admin_order_link = admin_url( 'post.php?post=' . absint( $_pro_id ) . '&action=edit' );
// $message = __('New Add Property','wpdt-property-submit') . "\n\n";
// $message .= sprintf(__('Title: %s','wpdt-property-submit'), $_pro_title) . "\n";
// $message .= sprintf(__('Username: %s','wpdt-property-submit'), $user_login) . "\n\n";
// //$message .= sprintf(__('E-mail: %s','wpdt-property-submit'), $user_email) . "\n\n";
// $message .= sprintf(__('View Detail: %s','wpdt-property-submit'), $admin_order_link);
// //echo $message;
// do_action('wpdt_line_notify_text',$message);
// }
$status = isset($_REQUEST['message']) ? $_REQUEST['message'] : "ok";
if($status=='ok'){
echo '<p class="alert alert-success" role="alert"> <strong>เราได้รับข้อมูลของคุณเชิญลงประกาศได้แล้วค่ะ</strong>';
echo '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>';
echo '</p>';
}
?>
<h1><?php echo __('New Add Property','wpdt-property-submit'); ?></h1>
<form action="<?php //the_permalink(); ?>" method="post" enctype="multipart/form-data" name="wpdt_property_submit_form" id="wpdt_property_submit_form">
<div class="entry-header">
<div class="title-info">
<p class="subtmi-title">
<label>ชื่ออสังหาริมทรัพย์ *จำเป็นต้องกรอกด้วย*</label>
<input class="title-text widefat" autofocus placeholder="ใส่ชื่ออสังหาริมทรัพย์ให้ครบถ้วน" name="_pro_title" type="text" value="<?php echo $_pro_title; ?>" />
</p>
</div>
</div>
<div class="row">
<div class="col-md-8 col-sm-8">
<div class="entry-meta">
<span class="proprty-info bedrooms">
<label>จำนวนห้องนอน</label><br>
<select name="_pro_bedrooms" class="small-select">
<option value="" <?php if (!(strcmp("", $_pro_bedrooms))) {echo "selected=\"selected\"";} ?>>-</option>
<option value="1" <?php if (!(strcmp(1, $_pro_bedrooms))) {echo "selected=\"selected\"";} ?>>1</option>
<option value="2" <?php if (!(strcmp(2, $_pro_bedrooms))) {echo "selected=\"selected\"";} ?>>2</option>
<option value="3" <?php if (!(strcmp(3, $_pro_bedrooms))) {echo "selected=\"selected\"";} ?>>3</option>
<option value="4" <?php if (!(strcmp(4, $_pro_bedrooms))) {echo "selected=\"selected\"";} ?>>4</option>
<option value="5" <?php if (!(strcmp(5, $_pro_bedrooms))) {echo "selected=\"selected\"";} ?>>5</option>
<option value="6" <?php if (!(strcmp(6, $_pro_bedrooms))) {echo "selected=\"selected\"";} ?>>6</option>
<option value="7" <?php if (!(strcmp(7, $_pro_bedrooms))) {echo "selected=\"selected\"";} ?>>7</option>
<option value="8" <?php if (!(strcmp(8, $_pro_bedrooms))) {echo "selected=\"selected\"";} ?>>8</option>
<option value="9" <?php if (!(strcmp(9, $_pro_bedrooms))) {echo "selected=\"selected\"";} ?>>9</option>
<option value="10" <?php if (!(strcmp(10, $_pro_bedrooms))) {echo "selected=\"selected\"";} ?>>10</option>
</select>
</span>
<span class="proprty-info bathrooms">
<label>จำนวนห้องน้ำ</label><br>
<select name="_pro_bathrooms" class="small-select">
<option value="" <?php if (!(strcmp("", $_pro_bathrooms))) {echo "selected=\"selected\"";} ?>>-</option>
<option value="1" <?php if (!(strcmp(1, $_pro_bathrooms))) {echo "selected=\"selected\"";} ?>>1</option>
<option value="2" <?php if (!(strcmp(2, $_pro_bathrooms))) {echo "selected=\"selected\"";} ?>>2</option>
<option value="3" <?php if (!(strcmp(3, $_pro_bathrooms))) {echo "selected=\"selected\"";} ?>>3</option>
<option value="4" <?php if (!(strcmp(4, $_pro_bathrooms))) {echo "selected=\"selected\"";} ?>>4</option>
<option value="5" <?php if (!(strcmp(5, $_pro_bathrooms))) {echo "selected=\"selected\"";} ?>>5</option>
<option value="6" <?php if (!(strcmp(6, $_pro_bathrooms))) {echo "selected=\"selected\"";} ?>>6</option>
<option value="7" <?php if (!(strcmp(7, $_pro_bathrooms))) {echo "selected=\"selected\"";} ?>>7</option>
<option value="8" <?php if (!(strcmp(8, $_pro_bathrooms))) {echo "selected=\"selected\"";} ?>>8</option>
<option value="9" <?php if (!(strcmp(9, $_pro_bathrooms))) {echo "selected=\"selected\"";} ?>>9</option>
<option value="10" <?php if (!(strcmp(10, $_pro_bathrooms))) {echo "selected=\"selected\"";} ?>>10</option>
</select>
</span>
<p class="proprty-info area">
<label>พื้นที่ใช้สอย</label><br>
<input class="small-text" name="_pro_area" type="text" value="<?php echo $_pro_area; ?>" /> (ตรม.)
<input class="small-text" name="_pro_floor" type="text" value="<?php echo $_pro_floor; ?>" /> ชั้น
</p>
</div>
<div role="main" class="site-content single-property" id="content">
<div class="form-submit">
<div class="propery-infos">
<h3 class="post-subject">ข้อมูลประกาศ *ควรลงให้ละเอียด*</h3>
<div class="proerpty-list-info">
<p class="proerpty-name">
<label class="label">ชื่อโครงการ</label>
<span class="text">
<input class="large-text" name="_pro_project" type="text" value="<?php echo $_pro_project; ?>" />
</span>
</p>
</div>
<div class="proerpty-list-info">
<div class="proerpty-name">
<label class="label">มีความต้องการ</label>
<div class="text">
<ul class="proeoty-info-right">
<?php
$args = array( 'hide_empty' => false );
$terms = get_terms('property_type', $args);
$count = count($terms); $i=0;
if ($count > 0) {
foreach ($terms as $term) {
$checked = "";
if (in_array($term->term_id, $_pro_property_type)) {
$checked = 'checked="checked"';
}
echo '<li><label><input '.$checked.' name="_pro_property_type[]" type="checkbox" value="'.$term->term_id.'" /> '.trim($term->name).'</label></li>';
}
}
?>
</ul>
</div>
</div>
</div>
<div class="proerpty-list-info">
<p class="proerpty-name">
<label class="label">ประเภทประกาศ</label>
<span class="text">
<select name="_pro_type">
<?php
$args = array( 'hide_empty' => false );
$terms = get_terms('category', $args);
$count = count($terms); $i=0;
if ($count > 0) {
echo '<option value="">--เลือกประเภทประกาศ--</option>';
foreach ($terms as $term) {
echo '<option value="'.$term->term_id.'" '.selected($_pro_type, $term->term_id ,false).'>'.$term->name.'</option>';
}
}
?>
</select>
</span>
</p>
</div>
<div class="proerpty-list-info">
<p class="proerpty-name">
<label class="label">ขนาดที่ดิน</label>
<span class="text">
<input class="small-text" name="_pro_area_land" placeholder="ไร่-งาน-ตรว" type="text" value="<?php echo $_pro_area_land; ?>" /> (ไร่)
</span>
</p>
</div>
<div class="proerpty-list-info">
<p class="proerpty-name">
<label class="label">จังหวัด</label>
<span class="text">
<select name="_pro_location">
<?php
$args = array( 'hide_empty' => false );
$terms = get_terms('location', $args);
$count = count($terms); $i=0;
if ($count > 0) {
echo '<option value="">--เลือกจังหวัด--</option>';
foreach ($terms as $term) {
echo '<option value="'.$term->term_id.'" '.selected($_pro_location, $term->term_id ,false).'>'.$term->name.'</option>';
}
}
?>
</select>
</span>
</p>
</div>
<div class="proerpty-list-info address">
<div class="proerpty-name">
<label class="label">ตำบล/อำเภอที่ตั้ง</label>
<div class="text">
<input id="_pro_address" class="large-text" name="_pro_address" type="text" value="<?php echo $_pro_address; ?>" />
</div>
</div>
</div>
<div class="proerpty-list-info voyage">
<div class="proerpty-name">
<label class="label">การเดินทาง</label>
<div class="text">
<textarea class="large-text" name="_pro_voyage" cols="70" rows="2"><?php echo $_pro_voyage ; ?></textarea>
</div>
</div>
</div>
<div class="proerpty-list-info map">
<div class="proerpty-name">
<label class="label">แผนที่</label>
<div class="text">
<input id="_pro_lat" name="_pro_lat" type="hidden" value="<?php echo $_pro_lat; ?>" />
<input id="_pro_lng" name="_pro_lng" type="hidden" value="<?php echo $_pro_lng; ?>" />
<input id="_pro_zoom" name="_pro_zoom" type="hidden" value="<?php echo $_pro_zoom; ?>" />
<div class="map-search-box">
<input id="map_search_input" name="map_search_input" type="text" />
</div>
<div data-zoom="<?php echo $_pro_zoom; ?>" data-lng="<?php echo $_pro_lng; ?>" data-lat="<?php echo $_pro_lat; ?>" id="property-map"> </div>
<style type="text/css">
#property-map{ height:250px; width:100%; display:block; border:1px solid #CCCCCC; }
#map_search_input{
background-color: #FFFFFF;
font-weight: 300;
padding: 0 11px 0 13px;
text-overflow: ellipsis;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
border: 1px solid transparent;
-moz-box-sizing: border-box;
outline: none;
margin-top: 10px;
height: 40px;
}
.wp-editor-container{ border:#ccc solid 1px; }
</style>
</div>
<script type="text/javascript">
jQuery(document).ready(function ($) {
if($('#property-map').length != 0) {
var latitude = $('#property-map').data('lat');
var longitude = $('#property-map').data('lng');
var zoom = $('#property-map').data('zoom');
latlng = new google.maps.LatLng(latitude, longitude);
zoom = 17;
var mapOptions = {
center: latlng,
zoom: zoom,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map($('#property-map').get(0), mapOptions);
var input = $('#map_search_input').get(0);
map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);
var autocomplete = new google.maps.places.Autocomplete(input);
autocomplete.bindTo('bounds', map);
var marker = new google.maps.Marker({
map: map,
draggable: true
});
marker.setPosition(latlng);
google.maps.event.addListener(autocomplete, 'place_changed', function() {
var place = autocomplete.getPlace();
if (place.geometry.viewport) {
map.fitBounds(place.geometry.viewport);
} else {
map.setCenter(place.geometry.location);
map.setZoom(17);
}
marker.setPosition(place.geometry.location);
$("#_pro_lat").val(place.geometry.location.lat());
$("#_pro_lng").val(place.geometry.location.lng());
$("#_pro_zoom").val(map.getZoom());
});
google.maps.event.addListener(marker, 'drag', function() {
$('#_pro_lat').val(marker.getPosition().lat());
$('#_pro_lng').val(marker.getPosition().lng());
$("#_pro_zoom").val(map.getZoom());
});
$(input).keypress(function(event) {
if(event.keyCode == 13) {
event.preventDefault();
}
});
}
});
</script>
</div>
</div>
<div class="proerpty-list-info rate-price">
<div class="proerpty-name">
<label class="label">เรทราคาใกล้เคียง</label>
<span class="text">
<select name="_pro_price_rate">
<?php
$args = array( 'hide_empty' => false );
$terms = get_terms('price_rate', $args);
$count = count($terms); $i=0;
if ($count > 0) {
echo '<option value="">--เลือกเรทราคาใกล้เคียง--</option>';
foreach ($terms as $term) {
$i++;
echo '<option value="'.$term->term_id.'" '.selected($_pro_price_rate,$term->term_id,false).'>'.$term->name.'</option>';
}
}
?>
</select>
</span>
</div>
</div>
<div class="proerpty-list-info price">
<div class="proerpty-name">
<label class="label">ราคาสำหรับขาย</label>
<div class="text price">
<input class="small-text" name="_pro_price" type="text" value="<?php echo $_pro_price; ?>" />
</div>
</div>
</div>
<div class="proerpty-list-info price-rent">
<div class="proerpty-name">
<label class="label">ราคาสำหรับให้เช่า</label>
<div class="text price">
<input class="small-text" name="_pro_price_rent" type="text" value="<?php echo $_pro_price_rent; ?>" />
</div>
</div>
</div>
<p> </p>
<div class="proerpty-list-info length">
<h3 class="post-subject">สิ่งอำนวยความสะดวก</h3>
<p class="proerpty-list-info">
<label class="label abel post-subject-2">สถานที่ใกล้เคียง</label>
</p>
<ul class="proeoty-info">
<?php
$args = array( 'hide_empty' => false );
$terms = get_terms('nearby', $args);
$count = count($terms); $i=0;
if ($count > 0) {
foreach ($terms as $term) {
$checked = "";
if (in_array($term->term_id, $_pro_nearby)) {
$checked = 'checked="checked"';
}
echo '<li><label class="checked"><input '.$checked.' name="_pro_nearby[]" type="checkbox" value="'.$term->term_id.'" /> '.trim($term->name).'</label></li>';
}
}
?>
</ul>
<p></p>
<p class="proerpty-list-info length">
<label class="label abel post-subject-2">สิ่งอำนวยความสะดวกภายนอก</label>
</p>
<ul class="proeoty-info">
<?php
$args = array( 'hide_empty' => false );
$terms = get_terms('facilities_outside', $args);
$count = count($terms); $i=0;
if ($count > 0) {
foreach ($terms as $term) {
$checked = "";
if (in_array($term->term_id, $_pro_facilities_outside)) {
$checked = 'checked="checked"';
}
echo '<li><label class=" checked"><input '.$checked.' name="_pro_facilities_outside[]" type="checkbox" value="'.$term->term_id.'" /> '.trim($term->name).'</label></li>';
}
}
?>
</ul>
<p></p>
<p class="proerpty-list-info length">
<label class="label post-subject-2">สิ่งอำนวยความสะดวกภายใน</label>
</p>
<ul class="proeoty-info">
<?php
$args = array( 'hide_empty' => false );
$terms = get_terms('facilities_inside', $args);
$count = count($terms); $i=0;
if ($count > 0) {
foreach ($terms as $term) {
$checked = "";
if (in_array($term->term_id, $_pro_facilities_inside)) {
$checked = 'checked="checked"';
}
echo '<li><label class="checked"><input '.$checked.' name="_pro_facilities_inside[]" type="checkbox" value="'.$term->term_id.'" /> '.trim($term->name).'</label></li>';
}
}
?>
</ul>
<p></p>
</div>
</div>
</div>
<p class="description">
<h3 class="post-subject">รายละเอียดเพิ่มเติม</h3>
<?php
$settings = array( 'textarea_name,'=>'_pro_description' , 'media_buttons' => false,'editor_height'=>20 ,'teeny'=>true,'dfw'=>true,'quicktags'=>false);
wp_editor( $_pro_description , "_pro_description" ,$settings);
?>
</p>
<p class="tags">
<label class="post-tags">แท็ก</label>
<input class="large-text" placeholder="ตัวอย่าง: แท็ก1,แท็ก2,แท็ก3,..." name="_pro_tags" type="text" value="<?php echo $_pro_tags; ?>" />
</p>
<div class="property-gallery">
<h3>เกลอรี่</h3>
<div class="panel panel-default">
<?php
$images_limit = 12;
echo '<div class="col-sm-12 upload-thumbnails">';
foreach($_pro_images as $_pro_image_id){
$image_attributes = wp_get_attachment_image_src( $_pro_image_id,'large' );
$image_attributes_thumbnail = wp_get_attachment_image_src( $_pro_image_id,'thumbnail' );
echo '<div class="upload-thumbnail"><img src="'.$image_attributes_thumbnail[0].'" />';
echo ' <div class="actions">';
echo ' <a class="action del" href="#" data-id="'.$_pro_image_id.'" data-postid="'.$_pro_id .'">'._('ลบ').'</a>';
echo ' <span class="step"> | </span>';
echo ' <a class="action featured" href="#" data-id="'.$_pro_image_id.'" data-postid="'.$_pro_id .'">'._('ตั้งเป็นภาพหลัก').'</a>';
echo ' </div>';
echo '</div>';
}
echo '</div>';
for($file=1; $file <= ($images_limit-count($_pro_images)); $file++){
?>
<p class="col-sm-6">
<label class="inline">เลือกรูปที่ <?php echo $file; ?> : </label>
<input type="file" name="_pro_images[]" id="images<?php echo $file; ?>">
</p>
<?php } ?>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<div class="col-md-4 col-sm-4">
<div class="widget contact-info">
<h3 class="widget-title">ข้อมูลผู้ประกาศ</h3>
<div class="widget-content">
<p class="contact-name">
<label>ชื่อผู้ติดต่อ</label>
<input class="large-text" name="_pro_contact_name" type="text" value="<?php echo esc_html( um_user( 'display_name' ) ); ?>" />
</p>
<p class="phone">
<label>เบอร์โทรผู้ติดต่อ</label>
<input class="large-text" name="_pro_contact_phone" type="text" value="<?php echo esc_html( um_user( 'phone_number' ) ); ?>" />
</p>
<p class="lineid">
<label>LINE ID</label>
<input class="large-text" name="_pro_contact_line_id" type="text" value="<?php echo $_pro_contact_line_id; ?>" />
</p>
<p class="facebook">
<label>ชื่อเฟสบุ๊ค</label>
<input class="large-text" name="_pro_contact_facebook" type="text" value="<?php echo esc_html( um_user( 'facebook' ) ); ?>" />
</p>
<p class="email">
<label>อีเมล์ผู้ติดต่อ</label>
<input class="large-text" name="_pro_contact_email" type="text" value="<?php echo esc_html( um_user( 'user_email' ) ); ?>" />
</p>
</div>
<div class="scatteringx">
<label>จุดเด่น</label>
<textarea class="large-text " name="_pro_scattering" cols="20" rows="3"><?php echo $_pro_scattering; ?></textarea>
</div>
</div>
</div>
</div>
<div class="clear"></div>
<div class="entry-footer">
<hr />
<input name="_pro_id" type="hidden" value="<?php echo $_pro_id; ?>">
<input type="submit" name="submit" id="submit" class="button button-primary" value="บันทึก"/>
<?php if(false){ ?>
<input name="_pro_status" type="hidden" value="<?php echo $_pro_status; ?>">
<?php }else{ ?>
<select name="_pro_status" class="select-statu" style="height: 32px; float: left; margin-right: 10px; padding: 5px;">
<option value="publish" <?php if (!(strcmp("publish", $_pro_status))) {echo "selected=\"selected\"";} ?>>เผยแพร่</option>
</select>
<?php } ?>
<?php
if(isset($_REQUEST['action']) && $_REQUEST['action']=="update"){
wp_nonce_field('update_wpdt_property_submit','update_wpdt_property_submit_field');
?>
<?php if($_pro_status == "draft"){ ?>
<a target="_blank" href="<?php echo esc_url( home_url( '/' ) ); ?>?p=<?php echo $_pro_id ; ?>&preview=true" class="button proview">(สถานะยังไม่เผยแพร่) ดูตัวอย่าง </a>
<?php } ?>
<?php if($_pro_status == "publish"){ ?>
<a target="_blank" href="<?php echo get_permalink($_pro_id); ?>" class="button proview">(สถานะเผยแพร่แล้ว) ดูผลงาน</a>
<?php } ?>
<?php
}else{
wp_nonce_field('add_wpdt_property_submit','add_wpdt_property_submit_field');
}
?>
</div>
</form>
Tag : PHP, HTML, CSS, Action Script, Ajax, jQuery
|
|
|
|
|
|
Date :
2021-04-06 11:09:59 |
By :
shinobuclub |
View :
518 |
Reply :
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
เอา code ใน tag ครับ คนมาช่วยเขาจะได้ดูง่าย
Code (PHP)
<?php
// if ( isset($_REQUEST['message']) && ($_REQUEST['message']=="ok")){
// $user_login = stripslashes($current_user->user_login);
// $user_email = stripslashes($current_user->user_email);
// $admin_order_link = admin_url( 'post.php?post=' . absint( $_pro_id ) . '&action=edit' );
// $message = __('New Add Property','wpdt-property-submit') . "\n\n";
// $message .= sprintf(__('Title: %s','wpdt-property-submit'), $_pro_title) . "\n";
// $message .= sprintf(__('Username: %s','wpdt-property-submit'), $user_login) . "\n\n";
// //$message .= sprintf(__('E-mail: %s','wpdt-property-submit'), $user_email) . "\n\n";
// $message .= sprintf(__('View Detail: %s','wpdt-property-submit'), $admin_order_link);
// //echo $message;
// do_action('wpdt_line_notify_text',$message);
// }
$status = isset($_REQUEST['message']) ? $_REQUEST['message'] : "ok";
if($status=='ok'){
echo '<p class="alert alert-success" role="alert"> <strong>เราได้รับข้อมูลของคุณเชิญลงประกาศได้แล้วค่ะ</strong>';
echo '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>';
echo '</p>';
}
?>
<h1><?php echo __('New Add Property','wpdt-property-submit'); ?></h1>
<form action="<?php //the_permalink(); ?>" method="post" enctype="multipart/form-data" name="wpdt_property_submit_form" id="wpdt_property_submit_form">
<div class="entry-header">
<div class="title-info">
<p class="subtmi-title">
<label>ชื่ออสังหาริมทรัพย์ *จำเป็นต้องกรอกด้วย*</label>
<input class="title-text widefat" autofocus placeholder="ใส่ชื่ออสังหาริมทรัพย์ให้ครบถ้วน" name="_pro_title" type="text" value="<?php echo $_pro_title; ?>" />
</p>
</div>
</div>
<div class="row">
<div class="col-md-8 col-sm-8">
<div class="entry-meta">
<span class="proprty-info bedrooms">
<label>จำนวนห้องนอน</label><br>
<select name="_pro_bedrooms" class="small-select">
<option value="" <?php if (!(strcmp("", $_pro_bedrooms))) {echo "selected=\"selected\"";} ?>>-</option>
<option value="1" <?php if (!(strcmp(1, $_pro_bedrooms))) {echo "selected=\"selected\"";} ?>>1</option>
<option value="2" <?php if (!(strcmp(2, $_pro_bedrooms))) {echo "selected=\"selected\"";} ?>>2</option>
<option value="3" <?php if (!(strcmp(3, $_pro_bedrooms))) {echo "selected=\"selected\"";} ?>>3</option>
<option value="4" <?php if (!(strcmp(4, $_pro_bedrooms))) {echo "selected=\"selected\"";} ?>>4</option>
<option value="5" <?php if (!(strcmp(5, $_pro_bedrooms))) {echo "selected=\"selected\"";} ?>>5</option>
<option value="6" <?php if (!(strcmp(6, $_pro_bedrooms))) {echo "selected=\"selected\"";} ?>>6</option>
<option value="7" <?php if (!(strcmp(7, $_pro_bedrooms))) {echo "selected=\"selected\"";} ?>>7</option>
<option value="8" <?php if (!(strcmp(8, $_pro_bedrooms))) {echo "selected=\"selected\"";} ?>>8</option>
<option value="9" <?php if (!(strcmp(9, $_pro_bedrooms))) {echo "selected=\"selected\"";} ?>>9</option>
<option value="10" <?php if (!(strcmp(10, $_pro_bedrooms))) {echo "selected=\"selected\"";} ?>>10</option>
</select>
</span>
<span class="proprty-info bathrooms">
<label>จำนวนห้องน้ำ</label><br>
<select name="_pro_bathrooms" class="small-select">
<option value="" <?php if (!(strcmp("", $_pro_bathrooms))) {echo "selected=\"selected\"";} ?>>-</option>
<option value="1" <?php if (!(strcmp(1, $_pro_bathrooms))) {echo "selected=\"selected\"";} ?>>1</option>
<option value="2" <?php if (!(strcmp(2, $_pro_bathrooms))) {echo "selected=\"selected\"";} ?>>2</option>
<option value="3" <?php if (!(strcmp(3, $_pro_bathrooms))) {echo "selected=\"selected\"";} ?>>3</option>
<option value="4" <?php if (!(strcmp(4, $_pro_bathrooms))) {echo "selected=\"selected\"";} ?>>4</option>
<option value="5" <?php if (!(strcmp(5, $_pro_bathrooms))) {echo "selected=\"selected\"";} ?>>5</option>
<option value="6" <?php if (!(strcmp(6, $_pro_bathrooms))) {echo "selected=\"selected\"";} ?>>6</option>
<option value="7" <?php if (!(strcmp(7, $_pro_bathrooms))) {echo "selected=\"selected\"";} ?>>7</option>
<option value="8" <?php if (!(strcmp(8, $_pro_bathrooms))) {echo "selected=\"selected\"";} ?>>8</option>
<option value="9" <?php if (!(strcmp(9, $_pro_bathrooms))) {echo "selected=\"selected\"";} ?>>9</option>
<option value="10" <?php if (!(strcmp(10, $_pro_bathrooms))) {echo "selected=\"selected\"";} ?>>10</option>
</select>
</span>
<p class="proprty-info area">
<label>พื้นที่ใช้สอย</label><br>
<input class="small-text" name="_pro_area" type="text" value="<?php echo $_pro_area; ?>" /> (ตรม.)
<input class="small-text" name="_pro_floor" type="text" value="<?php echo $_pro_floor; ?>" /> ชั้น
</p>
</div>
<div role="main" class="site-content single-property" id="content">
<div class="form-submit">
<div class="propery-infos">
<h3 class="post-subject">ข้อมูลประกาศ *ควรลงให้ละเอียด*</h3>
<div class="proerpty-list-info">
<p class="proerpty-name">
<label class="label">ชื่อโครงการ</label>
<span class="text">
<input class="large-text" name="_pro_project" type="text" value="<?php echo $_pro_project; ?>" />
</span>
</p>
</div>
<div class="proerpty-list-info">
<div class="proerpty-name">
<label class="label">มีความต้องการ</label>
<div class="text">
<ul class="proeoty-info-right">
<?php
$args = array( 'hide_empty' => false );
$terms = get_terms('property_type', $args);
$count = count($terms); $i=0;
if ($count > 0) {
foreach ($terms as $term) {
$checked = "";
if (in_array($term->term_id, $_pro_property_type)) {
$checked = 'checked="checked"';
}
echo '<li><label><input '.$checked.' name="_pro_property_type[]" type="checkbox" value="'.$term->term_id.'" /> '.trim($term->name).'</label></li>';
}
}
?>
</ul>
</div>
</div>
</div>
<div class="proerpty-list-info">
<p class="proerpty-name">
<label class="label">ประเภทประกาศ</label>
<span class="text">
<select name="_pro_type">
<?php
$args = array( 'hide_empty' => false );
$terms = get_terms('category', $args);
$count = count($terms); $i=0;
if ($count > 0) {
echo '<option value="">--เลือกประเภทประกาศ--</option>';
foreach ($terms as $term) {
echo '<option value="'.$term->term_id.'" '.selected($_pro_type, $term->term_id ,false).'>'.$term->name.'</option>';
}
}
?>
</select>
</span>
</p>
</div>
<div class="proerpty-list-info">
<p class="proerpty-name">
<label class="label">ขนาดที่ดิน</label>
<span class="text">
<input class="small-text" name="_pro_area_land" placeholder="ไร่-งาน-ตรว" type="text" value="<?php echo $_pro_area_land; ?>" /> (ไร่)
</span>
</p>
</div>
<div class="proerpty-list-info">
<p class="proerpty-name">
<label class="label">จังหวัด</label>
<span class="text">
<select name="_pro_location">
<?php
$args = array( 'hide_empty' => false );
$terms = get_terms('location', $args);
$count = count($terms); $i=0;
if ($count > 0) {
echo '<option value="">--เลือกจังหวัด--</option>';
foreach ($terms as $term) {
echo '<option value="'.$term->term_id.'" '.selected($_pro_location, $term->term_id ,false).'>'.$term->name.'</option>';
}
}
?>
</select>
</span>
</p>
</div>
<div class="proerpty-list-info address">
<div class="proerpty-name">
<label class="label">ตำบล/อำเภอที่ตั้ง</label>
<div class="text">
<input id="_pro_address" class="large-text" name="_pro_address" type="text" value="<?php echo $_pro_address; ?>" />
</div>
</div>
</div>
<div class="proerpty-list-info voyage">
<div class="proerpty-name">
<label class="label">การเดินทาง</label>
<div class="text">
<textarea class="large-text" name="_pro_voyage" cols="70" rows="2"><?php echo $_pro_voyage ; ?></textarea>
</div>
</div>
</div>
<div class="proerpty-list-info map">
<div class="proerpty-name">
<label class="label">แผนที่</label>
<div class="text">
<input id="_pro_lat" name="_pro_lat" type="hidden" value="<?php echo $_pro_lat; ?>" />
<input id="_pro_lng" name="_pro_lng" type="hidden" value="<?php echo $_pro_lng; ?>" />
<input id="_pro_zoom" name="_pro_zoom" type="hidden" value="<?php echo $_pro_zoom; ?>" />
<div class="map-search-box">
<input id="map_search_input" name="map_search_input" type="text" />
</div>
<div data-zoom="<?php echo $_pro_zoom; ?>" data-lng="<?php echo $_pro_lng; ?>" data-lat="<?php echo $_pro_lat; ?>" id="property-map"> </div>
<style type="text/css">
#property-map{ height:250px; width:100%; display:block; border:1px solid #CCCCCC; }
#map_search_input{
background-color: #FFFFFF;
font-weight: 300;
padding: 0 11px 0 13px;
text-overflow: ellipsis;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
border: 1px solid transparent;
-moz-box-sizing: border-box;
outline: none;
margin-top: 10px;
height: 40px;
}
.wp-editor-container{ border:#ccc solid 1px; }
</style>
</div>
<script type="text/javascript">
jQuery(document).ready(function ($) {
if($('#property-map').length != 0) {
var latitude = $('#property-map').data('lat');
var longitude = $('#property-map').data('lng');
var zoom = $('#property-map').data('zoom');
latlng = new google.maps.LatLng(latitude, longitude);
zoom = 17;
var mapOptions = {
center: latlng,
zoom: zoom,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map($('#property-map').get(0), mapOptions);
var input = $('#map_search_input').get(0);
map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);
var autocomplete = new google.maps.places.Autocomplete(input);
autocomplete.bindTo('bounds', map);
var marker = new google.maps.Marker({
map: map,
draggable: true
});
marker.setPosition(latlng);
google.maps.event.addListener(autocomplete, 'place_changed', function() {
var place = autocomplete.getPlace();
if (place.geometry.viewport) {
map.fitBounds(place.geometry.viewport);
} else {
map.setCenter(place.geometry.location);
map.setZoom(17);
}
marker.setPosition(place.geometry.location);
$("#_pro_lat").val(place.geometry.location.lat());
$("#_pro_lng").val(place.geometry.location.lng());
$("#_pro_zoom").val(map.getZoom());
});
google.maps.event.addListener(marker, 'drag', function() {
$('#_pro_lat').val(marker.getPosition().lat());
$('#_pro_lng').val(marker.getPosition().lng());
$("#_pro_zoom").val(map.getZoom());
});
$(input).keypress(function(event) {
if(event.keyCode == 13) {
event.preventDefault();
}
});
}
});
</script>
</div>
</div>
<div class="proerpty-list-info rate-price">
<div class="proerpty-name">
<label class="label">เรทราคาใกล้เคียง</label>
<span class="text">
<select name="_pro_price_rate">
<?php
$args = array( 'hide_empty' => false );
$terms = get_terms('price_rate', $args);
$count = count($terms); $i=0;
if ($count > 0) {
echo '<option value="">--เลือกเรทราคาใกล้เคียง--</option>';
foreach ($terms as $term) {
$i++;
echo '<option value="'.$term->term_id.'" '.selected($_pro_price_rate,$term->term_id,false).'>'.$term->name.'</option>';
}
}
?>
</select>
</span>
</div>
</div>
<div class="proerpty-list-info price">
<div class="proerpty-name">
<label class="label">ราคาสำหรับขาย</label>
<div class="text price">
<input class="small-text" name="_pro_price" type="text" value="<?php echo $_pro_price; ?>" />
</div>
</div>
</div>
<div class="proerpty-list-info price-rent">
<div class="proerpty-name">
<label class="label">ราคาสำหรับให้เช่า</label>
<div class="text price">
<input class="small-text" name="_pro_price_rent" type="text" value="<?php echo $_pro_price_rent; ?>" />
</div>
</div>
</div>
<p> </p>
<div class="proerpty-list-info length">
<h3 class="post-subject">สิ่งอำนวยความสะดวก</h3>
<p class="proerpty-list-info">
<label class="label abel post-subject-2">สถานที่ใกล้เคียง</label>
</p>
<ul class="proeoty-info">
<?php
$args = array( 'hide_empty' => false );
$terms = get_terms('nearby', $args);
$count = count($terms); $i=0;
if ($count > 0) {
foreach ($terms as $term) {
$checked = "";
if (in_array($term->term_id, $_pro_nearby)) {
$checked = 'checked="checked"';
}
echo '<li><label class="checked"><input '.$checked.' name="_pro_nearby[]" type="checkbox" value="'.$term->term_id.'" /> '.trim($term->name).'</label></li>';
}
}
?>
</ul>
<p></p>
<p class="proerpty-list-info length">
<label class="label abel post-subject-2">สิ่งอำนวยความสะดวกภายนอก</label>
</p>
<ul class="proeoty-info">
<?php
$args = array( 'hide_empty' => false );
$terms = get_terms('facilities_outside', $args);
$count = count($terms); $i=0;
if ($count > 0) {
foreach ($terms as $term) {
$checked = "";
if (in_array($term->term_id, $_pro_facilities_outside)) {
$checked = 'checked="checked"';
}
echo '<li><label class=" checked"><input '.$checked.' name="_pro_facilities_outside[]" type="checkbox" value="'.$term->term_id.'" /> '.trim($term->name).'</label></li>';
}
}
?>
</ul>
<p></p>
<p class="proerpty-list-info length">
<label class="label post-subject-2">สิ่งอำนวยความสะดวกภายใน</label>
</p>
<ul class="proeoty-info">
<?php
$args = array( 'hide_empty' => false );
$terms = get_terms('facilities_inside', $args);
$count = count($terms); $i=0;
if ($count > 0) {
foreach ($terms as $term) {
$checked = "";
if (in_array($term->term_id, $_pro_facilities_inside)) {
$checked = 'checked="checked"';
}
echo '<li><label class="checked"><input '.$checked.' name="_pro_facilities_inside[]" type="checkbox" value="'.$term->term_id.'" /> '.trim($term->name).'</label></li>';
}
}
?>
</ul>
<p></p>
</div>
</div>
</div>
<p class="description">
<h3 class="post-subject">รายละเอียดเพิ่มเติม</h3>
<?php
$settings = array( 'textarea_name,'=>'_pro_description' , 'media_buttons' => false,'editor_height'=>20 ,'teeny'=>true,'dfw'=>true,'quicktags'=>false);
wp_editor( $_pro_description , "_pro_description" ,$settings);
?>
</p>
<p class="tags">
<label class="post-tags">แท็ก</label>
<input class="large-text" placeholder="ตัวอย่าง: แท็ก1,แท็ก2,แท็ก3,..." name="_pro_tags" type="text" value="<?php echo $_pro_tags; ?>" />
</p>
<div class="property-gallery">
<h3>เกลอรี่</h3>
<div class="panel panel-default">
<?php
$images_limit = 12;
echo '<div class="col-sm-12 upload-thumbnails">';
foreach($_pro_images as $_pro_image_id){
$image_attributes = wp_get_attachment_image_src( $_pro_image_id,'large' );
$image_attributes_thumbnail = wp_get_attachment_image_src( $_pro_image_id,'thumbnail' );
echo '<div class="upload-thumbnail"><img src="'.$image_attributes_thumbnail[0].'" />';
echo ' <div class="actions">';
echo ' <a class="action del" href="#" data-id="'.$_pro_image_id.'" data-postid="'.$_pro_id .'">'._('ลบ').'</a>';
echo ' <span class="step"> | </span>';
echo ' <a class="action featured" href="#" data-id="'.$_pro_image_id.'" data-postid="'.$_pro_id .'">'._('ตั้งเป็นภาพหลัก').'</a>';
echo ' </div>';
echo '</div>';
}
echo '</div>';
for($file=1; $file <= ($images_limit-count($_pro_images)); $file++){
?>
<p class="col-sm-6">
<label class="inline">เลือกรูปที่ <?php echo $file; ?> : </label>
<input type="file" name="_pro_images[]" id="images<?php echo $file; ?>">
</p>
<?php } ?>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<div class="col-md-4 col-sm-4">
<div class="widget contact-info">
<h3 class="widget-title">ข้อมูลผู้ประกาศ</h3>
<div class="widget-content">
<p class="contact-name">
<label>ชื่อผู้ติดต่อ</label>
<input class="large-text" name="_pro_contact_name" type="text" value="<?php echo esc_html( um_user( 'display_name' ) ); ?>" />
</p>
<p class="phone">
<label>เบอร์โทรผู้ติดต่อ</label>
<input class="large-text" name="_pro_contact_phone" type="text" value="<?php echo esc_html( um_user( 'phone_number' ) ); ?>" />
</p>
<p class="lineid">
<label>LINE ID</label>
<input class="large-text" name="_pro_contact_line_id" type="text" value="<?php echo $_pro_contact_line_id; ?>" />
</p>
<p class="facebook">
<label>ชื่อเฟสบุ๊ค</label>
<input class="large-text" name="_pro_contact_facebook" type="text" value="<?php echo esc_html( um_user( 'facebook' ) ); ?>" />
</p>
<p class="email">
<label>อีเมล์ผู้ติดต่อ</label>
<input class="large-text" name="_pro_contact_email" type="text" value="<?php echo esc_html( um_user( 'user_email' ) ); ?>" />
</p>
</div>
<div class="scatteringx">
<label>จุดเด่น</label>
<textarea class="large-text " name="_pro_scattering" cols="20" rows="3"><?php echo $_pro_scattering; ?></textarea>
</div>
</div>
</div>
</div>
<div class="clear"></div>
<div class="entry-footer">
<hr />
<input name="_pro_id" type="hidden" value="<?php echo $_pro_id; ?>">
<input type="submit" name="submit" id="submit" class="button button-primary" value="บันทึก"/>
<?php if(false){ ?>
<input name="_pro_status" type="hidden" value="<?php echo $_pro_status; ?>">
<?php }else{ ?>
<select name="_pro_status" class="select-statu" style="height: 32px; float: left; margin-right: 10px; padding: 5px;">
<option value="publish" <?php if (!(strcmp("publish", $_pro_status))) {echo "selected=\"selected\"";} ?>>เผยแพร่</option>
</select>
<?php } ?>
<?php
if(isset($_REQUEST['action']) && $_REQUEST['action']=="update"){
wp_nonce_field('update_wpdt_property_submit','update_wpdt_property_submit_field');
?>
<?php if($_pro_status == "draft"){ ?>
<a target="_blank" href="<?php echo esc_url( home_url( '/' ) ); ?>?p=<?php echo $_pro_id ; ?>&preview=true" class="button proview">(สถานะยังไม่เผยแพร่) ดูตัวอย่าง </a>
<?php } ?>
<?php if($_pro_status == "publish"){ ?>
<a target="_blank" href="<?php echo get_permalink($_pro_id); ?>" class="button proview">(สถานะเผยแพร่แล้ว) ดูผลงาน</a>
<?php } ?>
<?php
}else{
wp_nonce_field('add_wpdt_property_submit','add_wpdt_property_submit_field');
}
?>
</div>
</form>
|
|
|
|
|
Date :
2021-04-08 15:38:22 |
By :
mongkon.k |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
อยู่หน้าเดิม ก็ถูกแ้ว มันไม่มี action url
Code บรรทัด ที่ 35
<form action="<?php //the_permalink(); ?>"
|
|
|
|
|
Date :
2021-04-08 15:40:40 |
By :
mongkon.k |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|