Title: Create a store with php
Last modified: August 27, 2020

---

# Create a store with php

 *  Resolved [facemail4me](https://wordpress.org/support/users/facemail4me/)
 * (@facemail4me)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/create-a-store-with-php/)
 * Hi,
    i am looking for a way to add stores automatically. I thought you could 
   use a Contact form 7 and then create the store in a hook. What would be the best
   function for that?

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Thread Starter [facemail4me](https://wordpress.org/support/users/facemail4me/)
 * (@facemail4me)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/create-a-store-with-php/#post-13325264)
 * i would like to have the function that is used at CSV import, which also maps
   the fields and calculates GPS.
    If I buy the add-on, do I have such a function
   and if so, what is it called?
 *  Plugin Author [Tijmen Smit](https://wordpress.org/support/users/tijmensmit/)
 * (@tijmensmit)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/create-a-store-with-php/#post-13326429)
 * The code in the CSV Manager runs on import only, so it’s not a standalone function
   that you can use.
 * But if your comfortable with code use [wp_insert_post](https://developer.wordpress.org/reference/functions/wp_insert_post/)
   and set the post type to wpsl_stores.
 * Next set the meta data with the returned post id with [update_post_meta](https://developer.wordpress.org/reference/functions/update_post_meta/).
   You can get a list of used meta fields with [this function](https://plugins.trac.wordpress.org/browser/wp-store-locator/tags/2.2.233/inc/wpsl-functions.php#L645).
 * Geocoding the address can be done with [this function](https://plugins.trac.wordpress.org/browser/wp-store-locator/tags/2.2.233/inc/wpsl-functions.php#L480).
 * I will create a single function to get this done in the next update.
 *  Thread Starter [facemail4me](https://wordpress.org/support/users/facemail4me/)
 * (@facemail4me)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/create-a-store-with-php/#post-13326659)
 * okay thanks for the quick response.
    That’s what I call good support, i like 
   it When would the function be available?
 * And how do I get the “wpsl_get_address_latlng” function in the function.php? 
   The rest I know and can implement myself.
 *  Plugin Author [Tijmen Smit](https://wordpress.org/support/users/tijmensmit/)
 * (@tijmensmit)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/create-a-store-with-php/#post-13326757)
 * You will have to include the /plugins/wp-store-locator/inc/wpsl-functions.php
   file in the functions.php to call the wpsl_get_address_latlng function, or just
   copy [the code](https://plugins.trac.wordpress.org/browser/wp-store-locator/tags/2.2.233/inc/wpsl-functions.php#L480)
   and place it in a custom function.
 *  Thread Starter [facemail4me](https://wordpress.org/support/users/facemail4me/)
 * (@facemail4me)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/create-a-store-with-php/#post-13327490)
 * okay i get the error:
    Cannot redeclare wpsl_get_gmap_api_params() (previously
   declared in wp-content/plugins/wp-store-locator/inc/wpsl-functions.php:12)
 * i included like this:
    $file = ABSPATH.’wp-content/plugins/wp-store-locator/inc/
   wpsl-functions.php’; include($file);
 * and used it like this:
    $longlat = wpsl_get_address_latlng( $fields[ ‘street’].’‘.
   $fields[ ‘nr’ ] .’, ‘.$fields[ ‘city’ ] );
 *  Plugin Author [Tijmen Smit](https://wordpress.org/support/users/tijmensmit/)
 * (@tijmensmit)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/create-a-store-with-php/#post-13327569)
 * Try changing include($file) into require_once( $file );
 *  Thread Starter [facemail4me](https://wordpress.org/support/users/facemail4me/)
 * (@facemail4me)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/create-a-store-with-php/#post-13329073)
 * okay thx it works fine.
    YOu can add the post and meta in one function. Now i
   have another question. I need to ” Clear store locator transient cache” that 
   it will show, wen you don’ filld the search form. Is there a function for that?
 *  Plugin Author [Tijmen Smit](https://wordpress.org/support/users/tijmensmit/)
 * (@tijmensmit)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/create-a-store-with-php/#post-13337101)
 * Try this.
 *     ```
       $wpsl_admin = new WPSL_Admin();
       $wpsl_admin->delete_autoload_transient();
       ```
   

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Create a store with php’ is closed to new replies.

 * ![](https://ps.w.org/wp-store-locator/assets/icon-256x256.jpg?rev=1007784)
 * [WP Store Locator](https://wordpress.org/plugins/wp-store-locator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-store-locator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-store-locator/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-store-locator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-store-locator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-store-locator/reviews/)

 * 8 replies
 * 2 participants
 * Last reply from: [Tijmen Smit](https://wordpress.org/support/users/tijmensmit/)
 * Last activity: [5 years, 9 months ago](https://wordpress.org/support/topic/create-a-store-with-php/#post-13337101)
 * Status: resolved