This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[gmw_single_location] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function gmw_states_dropdown( $gmw ) { | |
global $wpdb; | |
//get states exist in locations table in database | |
//Note that DISTINCT is being used to make sure each state called only once. | |
$states = $wpdb->get_col(" | |
SELECT DISTINCT `state_long` | |
FROM {$wpdb->prefix}places_locator | |
WHERE `state_long` IS NOT NULL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gmw_states_dropdown( $gmw ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
do_action( 'gmw_search_form_before_distance', $gmw ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function gmw_states_dropdown( $gmw ) { | |
global $wpdb; | |
//get states exist in locations table in database | |
//Note that DISTINCT is being used to make sure each state called only once. | |
$states = $wpdb->get_col(" | |
SELECT DISTINCT `state_long` | |
FROM {$wpdb->prefix}places_locator | |
WHERE `state_long` IS NOT NULL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function gmw_state_filter( $clauses, $gmw ) { | |
global $wpdb; | |
/* | |
* we first do a form check to make sure we only filter the search form that we want. | |
* for this example I will use form with ID 1 | |
*/ | |
if ( $gmw['ID'] != 1 ) | |
return $clauses; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( !function_exists( 'array_replace_recursive' ) ) { | |
function array_replace_recursive($base, $replacements) { | |
foreach (array_slice(func_get_args(), 1) as $replacements) { | |
$bref_stack = array(&$base); | |
$head_stack = array($replacements); | |
do { | |
end($bref_stack); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function gmw_orderby_dropdown( $gmw ) { | |
//getting the chosen value so we could pre-select the selected value after page load | |
$selected = ( isset( $_GET['gmw_orderby'] ) && !empty( $_GET['gmw_orderby'] ) ) ? $_GET['gmw_orderby'] : ''; | |
?> | |
<select class="gmw-orderby-dropdown" name="gmw_orderby"> | |
<option value="distance" selected="selected">Order By</option> | |
<option value="distance" <?php if ( $selected == 'distance' ) echo 'selected="selected"'; ?>>Distance</option> | |
<option value="post_title" <?php if ( $selected == 'post_title' ) echo 'selected="selected"'; ?>>Alphabetically</option> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gmw_orderby_dropdown( $gmw ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function gmw_orderby_dropdown( $gmw ) { | |
//getting the chosen value so we could pre-select the selected value after page load | |
$selected = ( isset( $_GET['gmw_orderby' ) && !empty( $_GET['gmw_orderby'] ) ) ? $_GET['gmw_orderby'] : ''; | |
?> | |
<select class="gmw-orderby-dropdown" name="gmw_orderby"> | |
<option value="distance" selected="selected">Distance</option> | |
<option value="post_title" <?php if ( $selected == 'post_title' ) echo 'selected="selected"'; ?>>Alphabetically</option> | |
<option value="post_date" <?php if ( $selected == 'post_date' ) echo 'selected="selected"'; ?>>Post Date</option> | |
<option value="post_id" <?php if ( $selected == 'post_id' ) echo 'selected="selected"'; ?>>Post ID</option> |
OlderNewer