KNetwalker
Forum Replies Created
-
Forum: Plugins
In reply to: [Download Monitor] File Date in TemplateI would also like to include the post_date or file_date in the template.
I imagine it’s something like this:
<?php $dlm_download->the_post_date(); ?>Forum: Plugins
In reply to: [Dynamics 365 Integration] Show content to specific CRM contactsThank you. I’ll reach out about more specific questions.
Forum: Plugins
In reply to: [Rest Routes – Custom Endpoints for WordPress REST API] Custom Post TypesYes, I’d like to be able to filter by category of custom post types too!
Forum: Plugins
In reply to: [WP Store Locator] Different markers per categoryThis thread has almost everything you need to get it done. It worked for me. The only extra step I also had to do is copy the modified code from the wp-store-locator/js/wpsl-gmap.js file and paste it over the wp-store-locator/js/wpsl-gmap.min.js file.
Forum: Plugins
In reply to: [WP Store Locator] Wrong map pin location for every storeI’m experiencing this on my map too. It appears to be an accuracy issue when zoomed out that gets fixed when zoomed in. For example, I have a store in Miami, Florida, but when zoomed out it appears to be in the Bahamas. Perhaps it’s an issue with the store marker image anchor point?
Forum: Plugins
In reply to: [WP Store Locator] Different markers per category+1. I agree with Daniele that I’d love to know where to start working on this. Thanks.
Forum: Plugins
In reply to: [WP Store Locator] List All StoresHas there been any update on this? I’d like to show all stores with the map and geolocate the user on load. Or at least a listed directory of all stores would be nice. Let me know, thanks!
Forum: Plugins
In reply to: [WP Store Locator] How to API fetch stores to use on another website or app?With the WordPress 4.7 update, I was able to add API support. See my ticket here: https://wordpress.org/support/topic/add-store-locations-to-new-wp-rest-api/
Forum: Plugins
In reply to: [WP Store Locator] Add store locations to new WP REST APII was able to get it figured out. It might not be the prettiest, or most efficient, but this works for me:
// Adding API access to registration locations add_action( 'init', 'my_custom_post_type_rest_support', 25 ); function my_custom_post_type_rest_support() { global $wp_post_types; $post_type_name = 'wpsl_stores'; if( isset( $wp_post_types[ $post_type_name ] ) ) { $wp_post_types[$post_type_name]->show_in_rest = true; $wp_post_types[$post_type_name]->rest_base = locations; $wp_post_types[$post_type_name]->rest_controller_class = 'WP_REST_Posts_Controller'; } } //Remove Fields from API response function remove_content( $data, $post, $request ) { $_data = $data->data; unset ($_data ['content']); unset ($_data ['excerpt']); unset ($_data ['link']); unset ($_data ['author']); unset ($_data ['slug']); unset ($_data ['id']); unset ($_data ['date']); unset ($_data ['date_gmt']); unset ($_data ['guid']); unset ($_data ['modified']); unset ($_data ['modified_gmt']); unset ($_data ['type']); unset ($_data ['featured_media']); unset ($_data ['template']); $_data ['title'] = $_data ['title']['rendered']; $data = $_data; return $data; } add_filter( 'rest_prepare_wpsl_stores', 'remove_content', 12, 3 ); //Display fields add_action( 'rest_api_init', 'slug_register_fields' ); function slug_register_fields() { register_rest_field( 'wpsl_stores', 'address', array( 'get_callback' => 'slug_get_address' ) ); register_rest_field( 'wpsl_stores', 'address2', array( 'get_callback' => 'slug_get_address2' ) ); register_rest_field( 'wpsl_stores', 'city', array( 'get_callback' => 'slug_get_city' ) ); register_rest_field( 'wpsl_stores', 'state', array( 'get_callback' => 'slug_get_state' ) ); register_rest_field( 'wpsl_stores', 'zip', array( 'get_callback' => 'slug_get_zip' ) ); register_rest_field( 'wpsl_stores', 'lat', array( 'get_callback' => 'slug_get_lat' ) ); register_rest_field( 'wpsl_stores', 'lng', array( 'get_callback' => 'slug_get_lng' ) ); register_rest_field( 'wpsl_stores', 'phone', array( 'get_callback' => 'slug_get_phone' ) ); } // Get the value of the "address" field function slug_get_address( $object, $field_name, $request ) { return get_post_meta( $object['id'], 'wpsl_address', true ); } // Get the value of the "address2" field function slug_get_address2( $object, $field_name, $request ) { return get_post_meta( $object['id'], 'wpsl_address2', true ); } // Get the value of the "city" field function slug_get_city( $object, $field_name, $request ) { return get_post_meta( $object['id'], 'wpsl_city', true ); } // Get the value of the "state" field function slug_get_state( $object, $field_name, $request ) { return get_post_meta( $object['id'], 'wpsl_state', true ); } // Get the value of the "zip" field function slug_get_zip( $object, $field_name, $request ) { return get_post_meta( $object['id'], 'wpsl_zip', true ); } // Get the value of the "latitude" field function slug_get_lat( $object, $field_name, $request ) { return get_post_meta( $object['id'], 'wpsl_lat', true ); } // Get the value of the "longitude" field function slug_get_lng( $object, $field_name, $request ) { return get_post_meta( $object['id'], 'wpsl_lng', true ); } // Get the value of the "phone" field function slug_get_phone( $object, $field_name, $request ) { return get_post_meta( $object['id'], 'wpsl_phone', true ); }Forum: Plugins
In reply to: [WP Store Locator] Add store locations to new WP REST APII have added the following, which returns an address field, but the response is empty.
add_action( 'rest_api_init', 'slug_register_address' ); function slug_register_address() { register_rest_field( 'wpsl_stores', 'address', array( 'get_callback' => 'slug_get_address', 'update_callback' => null, 'schema' => null, ) ); } /** * Get the value of the "address" field * * @param array $object Details of current post. * @param string $field_name Name of field. * @param WP_REST_Request $request Current request * * @return mixed */ function slug_get_address( $object, $field_name, $request ) { return get_post_meta( $object[ 'id' ], $field_name, true ); }The meta fields are created with the following code. Do I need to call out the nesting under Location somehow?
$meta_fields = array( __( 'Location', 'wpsl' ) => array( 'address' => array( 'label' => __( 'Address', 'wpsl' ), 'required' => true )Thanks for your help.
- This reply was modified 9 years, 3 months ago by KNetwalker.
Forum: Plugins
In reply to: [WP Store Locator] Add store locations to new WP REST APIThanks. I have the stores showing in the API, but the custom fields like address, latitude, etc. aren’t showing in the response.
What do I need to have those show?
- This reply was modified 9 years, 3 months ago by KNetwalker. Reason: tagging responder, Luke
Forum: Plugins
In reply to: [WP Store Locator] Click list to zoom to map and show info windowI was referencing this thread, specifically where you said
replace the existing code with this code in the wpsl-gmap.min.js.
I did that and got to where I am now.
Now I just need the info window to pop up when a list item is clicked. Then it’ll be perfect!
Forum: Plugins
In reply to: [WP Store Locator] Showing location after clicking on the store nameI would also like to click on the store in the listing template and have the info window pop up in the map view. Click instead of hover.
I REALLY want to be able to do this too. If it would speed up development, would be willing to discuss payment.
Forum: Plugins
In reply to: [Plugin mp3-jplayer] Pop-out playerI REALLY want to figure this out as well!