Home Forums Plugin Support WP User Frontend Pro Need help with wp_postmeta fields!

This topic is: resolved

This topic contains 32 replies, has 5 voices, and was last updated by  lwrkrol 5 years, 9 months ago.

Viewing 15 posts - 16 through 30 (of 33 total)
  • Author
  • #2368

    Post count: 29

    From what I can see they're using
    to make the metaboxes somehow.

    $dirItemOptions = new WPAlchemy_MetaBox(array


    ‘id' => ‘_ait-dir-item',

    ‘title' => __(‘Options for item', ‘ait'),

    ‘types' => array(‘ait-dir-item'),

    ‘context' => ‘normal',

    ‘priority' => ‘core',

    ‘config' => dirname(__FILE__) . ‘/' . basename(__FILE__, ‘.php') . ‘.neon',

    ‘js' => dirname(__FILE__) . ‘/' . basename(__FILE__, ‘.php') . ‘.js',


    Also, here's the dir-item.php:



    Tareq Hasan
    Post count: 2831

    This theme seems complicated and it's using custom taxonomy for item locations. It's saving the location info in wp_options table and I must say it's BAD.


    Post count: 29

    That might be the custom taxonomy that refers to event-locations though. Could be wrong.


    Post count: 29

    They're using the Nette Framework that's being used over the WPLatte-framework. There's a so-called .neon file apparently that holds all the metabox's content. I'll try and see if I can write to those fields somehow.


    Post count: 29

    Sorry to spam, but all I can find is the action hook add_meta_boxes that looks like what we need. Only thing is that I don't know how to hook into it with the plugin.



    Tareq Hasan
    Post count: 2831

    Can you share the theme with me?


    Post count: 29

    Sent it to info@wedevs.com (it's a paid theme)


    Tareq Hasan
    Post count: 2831

    This solution will work for you.

    function wpufe_ait_integration( $post_id ) {

    $def_lat = $def_long = 0;

    if ( isset( $_POST[‘location'] ) ) {
    list( $def_lat, $def_long ) = explode( ‘,', $_POST[‘location'] );

    $ait_dir_item = array (
    ‘address' => isset( $_POST[‘address'] ) ? $_POST[‘address'] : ”,
    ‘gpsLatitude' => $def_lat,
    ‘gpsLongitude' => $def_long,
    ‘streetViewLatitude' => ”,
    ‘streetViewLongitude' => ”,
    ‘streetViewHeading' => ‘0',
    ‘streetViewPitch' => ‘0',
    ‘streetViewZoom' => ‘0',
    ‘telephone' => isset( $_POST[‘telephone'] ) ? $_POST[‘telephone'] : ”,
    'email' => isset( $_POST['email'] ) ? $_POST['email'] : ”,
    ‘web' => isset( $_POST[‘web'] ) ? $_POST[‘web'] : ”,
    ‘hoursMonday' => isset( $_POST[‘hours_monday'] ) ? $_POST[‘hours_monday'] : ”,
    ‘hoursTuesday' => isset( $_POST[‘hours_tuesday'] ) ? $_POST[‘hours_tuesday'] : ”,
    ‘hoursWednesday' => isset( $_POST[‘hours_wednesday'] ) ? $_POST[‘hours_wednesday'] : ”,
    ‘hoursThursday' => isset( $_POST[‘hoursThursday'] ) ? $_POST[‘hoursThursday'] : ”,
    ‘hoursFriday' => isset( $_POST[‘hoursFriday'] ) ? $_POST[‘hoursFriday'] : ”,
    ‘hoursSaturday' => isset( $_POST[‘hoursSaturday'] ) ? $_POST[‘hoursSaturday'] : ”,
    ‘hoursSunday' => isset( $_POST[‘hoursSunday'] ) ? $_POST[‘hoursSunday'] : ”,
    ‘alternativeContent' => isset( $_POST[‘alternativeContent'] ) ? $_POST[‘alternativeContent'] : ”,

    update_post_meta( $post_id, ‘_ait-dir-item', $ait_dir_item );

    add_action( ‘wpuf_add_post_after_insert', ‘wpufe_ait_integration' );
    add_action( ‘wpuf_edit_post_after_update', ‘wpufe_ait_integration' );

    You can't use the themes default meta box, because it's using kinda weird neon file. Just use the plugins default custom fields and use the to update your `_ait-dir-item` custom fields. All is needed to put the right `$_POST` value in that array. I am using the plugins google map and as it stores longitude and latitude in the same field, I am just exploding them and saving it to different array index. Hope that makes sense.


    Post count: 29

    WOW! It works! Tareq my man. Just gimme a sign how much a sixpack of your favorite beverage costs and I'll paypal it over straight away! I'll let all other WP Directory users know immediately!

    Thanks a LOT! 😀


    Post count: 115

    Hey Retroga 🙂 !

    I'm the same guys that had answered your post on ait themes support. So I'm happy you've found the right solution 🙂 !

    Could you explain me in details ?

    An other problem is that I have 150 agencies in a .csv and want to import them in WP Director. How can I do if I want to keep all the locations data etc… ?




    Tareq Hasan
    Post count: 2831

    I helped you by testing the theme myself because you were gentle enough, not like yelling for support :).

    I am not a fan of beverages, if you really want to donate, use this page, but that wouldn't be necessary ;).


    Post count: 29

    Hi Noomia,

    All you have to do is put the php code Tareq posted here inside your wpuf-functions.php and use the plugin to add the form fields to the plugin form.

    You can use the item-dir.neon file in the
    wp-content/themes/directory/AIT/Framework/CustomTypes/dir-item/ directory
    to check which metakeys and types of fields you can use. For the Google Maps functionality, use the WPUF Pro field and set it to the ‘location'  metakey, Tareq's script will automatically put it in the right fields.

    I've tested it and I can confirm it works, however (maybe unrelated) can't get the registration forms to work properly using the shortcode. If you could test that too, we could exclude it being a theme error.

    Cheers and thanks again!


    Post count: 5

    Wonderful solution, works perfectly. Thank you! Is there any way with this ait-directory integration to enable auto-population of the user's address on the google map with geolocation on the front end posting? In other words, instead of the user filling in the post address can the map detect their location and fill in the address and/or GPS for them?


    Tareq Hasan
    Post count: 2831

    You could auto populate, in that case you've to depend on users browser and permission. It always doesn't work correctly.


    Post count: 9

    Ok, I put this script in the wpuf-functions.php and it works great. The only thing I can not figure out is how to get the gmaps info.

    In the backend you enter the address like broadway, new york and then press the find address button and it finds the right location on the map.

    I created a form with the following fields:

    address –> metakey = address
    city –> no meta key since I use the taxonomy Location

    So how do I get the right coordinates when I save the item. I would like to combine address and city, calculate the coordinates and then save it in the meta field location.

    I have also tried a field with metakey ‘address' ad then enter broadway, new york but then I still have to press the button ‘find address'in the backend.

    Hope you can help

Viewing 15 posts - 16 through 30 (of 33 total)

The topic ‘Need help with wp_postmeta fields!’ is closed to new replies.