使用内置的Wordpress搜索表单:
<?php
if ( function_exists( 'woocommerce_product_search' ) ) {
echo woocommerce_product_search( array( 'limit' => 40 ) );
}
?>
<div class="col-lg-4 col-lg-offset-4">
<div class="input-group">
<input type='textbox' maxlength="8" id="item-search" name="s" class="form-control form-inline" value="<?php the_search_query();?>" placeholder="Enter your postcode e.g. SW1Y 4LG"/>
<span class="input-group-btn">
<button class="item-search-btn">search</button>
</span>
</div>
</div>
</form>
我已将其命名为显示在我的主页上(index.php):
<?php get_search_form(); ?>
我想添加一个if语句来显示:
<div id="postcode-no" class="col-lg-4 col-lg-offset-4">
Unfortunately this is incorrect.
</div>
所以我的index.php文件添加了:
<?php if (input-text=='SW12') { ?>
<div id="postcode-no" class="col-lg-4 col-lg-offset-4">
Unfortunately this is incorrect.
</div>
<?php } else if (input-text=='SW15'){ ?>
<div id="postcode-no2" class="col-lg-4 col-lg-offset-4">
Correct.
</div>
<?php } ?>
但它没有用。我是一个相当陌生的PHP,所以有人可以帮我解决我做错的事吗?提前谢谢!
答案 0 :(得分:1)
function initialize() {
var center = new google.maps.LatLng(37.4419, -122.1419);
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 3,
center: center,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var markers = [];
var markerImage = new google.maps.MarkerImage("chart.png",new google.maps.Size(24, 32));
$.getJSON( "http://example.com/data2.json", function( data ) {
$.each( data, function( key, val ) {
var dataDealers = val;
console.log(val.field_longitude);
var latLng = new google.maps.LatLng(dataDealers.field_latitude,dataDealers.field_longitude);
var marker = new google.maps.Marker({
position: latLng,
icon: markerImage
});
markers.push(marker);
});
});
var markerCluster = new MarkerClusterer(map, markers, {imagePath: 'm'});
}
google.maps.event.addDomListener(window, 'load', initialize);