搜索结果表单以显示另一页

时间:2016-06-29 11:58:06

标签: php wordpress forms

我在Wordpress上使用Vebra插件,他们使用短代码显示搜索区域和短代码以显示结果。

我的主页(http://lytham.voodoodev4.co.uk/)使用“搜索”短代码,我的“属性”短代码位于http://lytham.voodoodev4.co.uk/?page_id=33

当我在页面上搜索它只刷新页面时,如何将搜索结果推送到该页面?

搜索php:

<div id="propertyFilter" class="vp_search">
    <form action="<?php echo vp_get_search_link()?>" method="GET">
    <?php vp_hidden_fields(); ?>
    <div class="property_refine">Refine your search:</div>

    <div class="property_type">
        <?php vp_get_areas(); ?>       
    </div>
    <div class="property_search_group">
        <p>Minimum number of bedrooms</p>
        <?php vp_get_bedrooms(); ?>       
    </div>
    <div class="property_search_group vp_price">
        <p>Minimum price of property</p>
        <?php vp_get_minprice(); ?>               
    </div>
    <div class="property_search_group vp_price">
        <p>Maximum price of property</p>
        <?php vp_get_maxprice(); ?>       
    </div>
    <div class="property_search_group vp_rent">
        <p>Minimum rent for property</p>
        <?php vp_get_minrent(); ?>               
    </div>
    <div class="property_search_group vp_rent">
        <p>Maximum rent for property</p>
        <?php vp_get_maxrent(); ?>       
    </div>
    <div class="property_search_group vp_commercial">
        <p>Min Area (sqft)</p>
        <?php vp_get_minarea(); ?>
    </div>
    <div class="property_search_group vp_commercial">
        <p>Max Area (sqft)</p>
        <?php vp_get_maxarea(); ?>
    </div>
    <div class="property_search_group">
        <p>Type of property</p>
        <?php vp_get_property_types(); ?>
    </div>    

    <div class="property_search_group">
        <p>Location</p>
        <input type="text" id="vp_location" name="vp_location" placeholder="Enter postcode or place name" value="<?php vp_get_location(); ?>" />
    </div>
        
    <div class="property_search_group">
        <p>Search</p>
        <?php vp_get_radius(); ?>
    </div>
            
    <input class="submit" type="submit" value="Search" />
    </form>
 </div>

属性结果PHP:

    <div id="propertyResults">
        <?php  echo vp_list_head();
        if ($properties=vp_theproperties()) {
            switch (vp_get_view()) {
                case "list": ?>
                    <div id="propertyListView">
	                    <div id="propertyOrdering" class="clearfix">
		                    <div id="orderBy">
			                    <span id="vp_order_message">Order by:</span>
                                <?php vp_get_orderby(); ?>
                                <a href="#" id="viewMap" class="button">View Map</a>
                            </div>
	                    </div>
                        <div class="clearfix"> 
                            <?php foreach ($properties as $property) { ?>
                            <div class="property">
                                <div class="left_column">
                                    <div class="property_image">
                                        <a class="property_overview_thumb" href="<?php echo vp_propertyurl($property->vebraid); ?>" title="<?php echo $property->address_custom; ?>">
                                            <?php echo vp_propertyimage($property->vebraid,0,"property_image"); ?>
                                        </a>
                                    <div class="property_tagline"><?php echo $property->web_status; ?></div>
                                    </div>
                                </div>
                                <div class="right_column">
                                    <div class="property_summary">
                                        <h3 class="property_title">
                                            <a href="<?php echo vp_propertyurl($property->vebraid); ?>"><span><?php echo $property->address_custom; ?> <?php echo $property->property_type; ?></span></a>
                                        </h3>
                                        <h4 class="property_address"><?php echo $property->address_display; ?></h4>
                                        <div class="property_excerpt"><?php echo $property->excerpt; ?></div>		  
                                    </div>
                                </div>
                                <div class="property_features clearfix">
                                    <?php if ($property->area == "Commercial") {
                                        if (!empty($property->propertyarea_sqft)) {?>
                                        <span class="property_area"><?php echo $property->propertyarea_sqft; ?> sqft</span>
                                        <?php } ?>
                                    <?php } else {?>
                                        <span class="property_beds"><?php echo $property->bedrooms; ?> Bedrooms</span>
                                        <span class="property_baths"><?php echo $property->bathrooms; ?> Bathrooms</span>
                                    <?php } ?>
                                    <div class="property_price">&pound;<?php echo number_format($property->price,0,"",","); ?> <?php echo $property->price_postfix; ?><a href="<?php echo vp_propertyurl($property->vebraid); ?>" class="button property_button">View Details</a><?php do_action('vp_other_action_buttons',$property->vebraid,'button property_button') ?></div>
                                    
                                </div>
                            </div>
                            <?php } ?>
                        </div>
                        <div class="properties-paging">
                            <ul>
                                <?php if (vp_current_page() > 1) { ?>
                                <li><a href="#" data-id="<?php echo vp_current_page()-1; ?>" class="properties-page">&lt; Previous</a></li>
                                <?php } ?>
                                <li>Page <?php echo vp_current_page(); ?> of <?php echo vp_page_count(); ?></li>
                                <?php if (vp_current_page() < vp_page_count()) { ?>
                                <li><a href="#" data-id="<?php echo vp_current_page()+1; ?>" class="properties-page">&gt; Next</a></li>
                                <?php } ?>
                            </ul>
                        </div>
                    </div>
                <?php
                    break;
                case "map":?>
                    <div id="propertyMapView">
                        <div id="propertyOrdering" class="clearfix">
		                    <div id="orderBy">
                                <a href="#" id="viewList" class="button">View List</a>
                            </div>
	                    </div>

                        <?php vp_map_markers($properties); ?>
                        <div id="vp-map" style="width: 100%; height: 550px;"></div>
                    </div>         
                <?php
                    break;
                case "featured": ?>
                    <?php foreach ($properties as $property) { ?>
                    <div class="property">
                        <div class="left_column">
                            <div class="property_tagline badge_<?php echo str_replace(" ","_",$property->web_status); ?>"></div>
                            <div class="property_image">
                                <a class="property_overview_thumb" href="<?php echo vp_propertyurl($property->vebraid); ?>" title="<?php echo $property->address_name; ?>">
                                    <?php echo vp_propertyimage($property->vebraid,0,"property_image"); ?>
                                </a>
                            </div>
                        </div>
                        <div class="right_column">
                            <ul class="property_summary">
                                <li class="property_title">
                                    <a href="<?php echo vp_propertyurl($property->vebraid); ?>"><?php echo $property->address_custom; ?><span><?php echo $property->property_type; ?></span></a>
                                </li>
                                <li class="property_address"><?php echo $property->address_display; ?></li>			  
				                <li class="property_price">&pound;<?php echo number_format($property->price,0,"",","); ?> <?php echo $property->price_postfix; ?></li>
                            </ul>
                            <div class="buttons clearfix">
                                <a href="<?php echo vp_propertyurl($property->vebraid); ?>" class="button">View Details</a>
                            </div>
                        </div>
                    </div>
                    <?php } ?>
                <?php
                    break;
            } 
        } else { ?>
            <p>No matching properties found.  Please try alternative search criteria.</p>
        <?php } ?>
        <?php echo vp_list_footer();?>
    </div>

1 个答案:

答案 0 :(得分:0)

解决:

在vp-search.php中,我改变了:

&#13;
&#13;
<form action="<?php echo vp_get_search_link()?>" method="GET">
&#13;
&#13;
&#13;

&#13;
&#13;
<form action="<?php echo vp_get_search_link()?>/property-results/" method="GET">
&#13;
&#13;
&#13;

显然将/ property-results /替换为其中包含shortcode属性的页面:)