You will need to know how CSS / HTML works if you want to change the design.
The store data is stored in the database as a custom post type, and adding new stores is simply by going to Store Locator -> New stores.
To make the store locator show up on your page simply go to Pages -> Add new, add the [wpsl] shortcode.
If you want to change the structure of the search results list, then you have to use this filter. The code from the usage section has to go in the functions.php inside your active theme folder where you can modify the structure / add new data fields / include more CSS classes. This will then be used to overwrite the existing search results template.
Thread Starter
nirna
(@nirna)
Thank you.
Whenn I copy the code from wpsl_listing_template in the functions.php, the result list disappear. And the map show only one in three stores.
I flush the store locator transient cache.
Sorry for my bad english.
-
This reply was modified 6 years, 5 months ago by nirna.
I seem to have forgotten to mention to remove line 31 – 33 from the code. This is included as an example how to include custom data, but it will break the store locator if you’re not using it.
Thread Starter
nirna
(@nirna)
Thank you. I could now customize the design.
I did not understand yet where the data stores are stored.
phpmyadmin: WordPress -> but there I find nothing.
The data is stored in the post and post_meta tables. Those tables are shared with all the other posts. Why do you need them?
Thread Starter
nirna
(@nirna)
Each store has additional data. For these custom tables are needed. One of them has a relationship to the store table.
When a user clicks on a store, it should be redirected to a page. On this the additional data are displayed.
Two Ideas:
1. Add tables to the existing ones
Which entries of the post and post_meta tables contain the stores? How can I create a table with a relationship to them?
How does the database connection work? How can I access the sparred data in WordPress for the frontend, how can I add new entries in the backend?
2. Create a new independent database or tables
There will then be two store tables with redundant data. But that’s not a Problem for my application.
Here again the question:
How does the database connection work? How can I access the sparred data in WordPress or the frontend, how can I add new entries for the backend?
You don’t need to make custom tables, this is all handled by WP internally.
If you want to create custom fields, then follow this article. It explains how to create them, include the data and how to make them show up on the frontend.
Thread Starter
nirna
(@nirna)
I do not understand how its possible to depict relationships.
I have something like this:
A store has several groups. In a group are several persons. A person can also be in several groups.
Store-Table
StoreID| Name | Phone | ….
Group-Table
GroupID | StoreID | Name
PersonGroup-Table
GroupPersonID | GroupID | PersonID
Person-table
PersonID | Name
How can I add a record for this?
With JSON i can only create Objects or Arrays,or not?
-
This reply was modified 6 years, 5 months ago by nirna.
-
This reply was modified 6 years, 5 months ago by nirna.
That will require custom SQL queries, but I don’t have time to write all that out.
There’s a wpsl_save_post action that runs when a post is saved. You can use this to do whatever you want with the saved data.
The action code has to go in the functions.php inside your active theme folder.
You can see the table structure of WP here.