a custom WordPress theme with the Custom Post Type (CPT)

Einfach Dinge, die nichts mit XAMPP, Apache Friends, Apache, MySQL, PHP und alle dem zu tun haben. Allerlei halt. ;)

a custom WordPress theme with the Custom Post Type (CPT)

Postby unleash_it » 03. December 2019 16:57

hello dear all


can we run a custom WordPress theme where the Custom Post Type (CPT) will contain meta-coordniate-data such as:

- latitude and
- longitude coordinate as it's meta value.

idea: The latitude and longitude-meta-data ought to be displayed as a Marker in a included Google Map.

So far it runs without any issue and problem in showing the Google-Map and the Marker (Custom Post Type (CPT)
That is if I query the CPT using the default order.

- some issues occurs when I need n CPTs that is closest to a coordinate whether it is current user position or a location clicked on the map.
- Another situation is to query all CPTs that is in x km radius of a coordinate.

so the remaining question is: How should i run a query posts based on latitude-longitude value that is saved on the post meta-data?
guess: the latitude and longitude-meta-value should be saved in a separate custom field.


possible solutions: i could have a closer look at the Geo Data Store plugin. It creates an optimized table for your lat/long coordinates and has two template tags to use.

https://wordpress.org/plugins/geo-data-store/

Description: This plugin is meant to be used by other developers and to be used together with themes and other plugins. Many themes and plugins use WordPress meta data table to store longitude and latitude co-ordinates for posts. While this works fine the meta data table cannot be indexed very well. Let’s take for example you have made a custom post type called ‘properties’. You create 100,000 posts all attached with latitude and longitude co-ordinates. You want your users to search for those properties in a 50 mile radius for example. Because of the method of which WordPress stores the meta data the query is
slow especially when dealing with large amounts of data.


Version:2.0.3
Last updated:7 years ago
Active installations:90+
WordPress Version:3.2 or higher
Tested up to:3.4.2


but can i do this without a plugin: do i need to access to both your longitude and latitude, so save it in a meta-data-field.

well any idea - i look forward to hear from you
unleash_it
 
Posts: 67
Joined: 10. December 2011 18:32
Operating System: linux opensuse 12.1

Return to Allerlei

Who is online

Users browsing this forum: No registered users and 1 guest