April 9, 2013 at 8:57 pm 1977
Hi there! I recently purchased a WordPress Theme that uses a custom taxonomy called “Items”, and I want to use WP User Frontend Pro to provide the frontend-editing for it. Now I do see several custom taxonomies showing up in the form editor, but there’s one field that I can’t get to work, and that’s the Google Map/Streetview field.
When I check PHPmyAdmin, I find the following field: _ait-dir-item in wp_postmeta
With the content:
I was wondering how I could access those variables, so that I can make this work with the theme.
Thanks in advance!
April 9, 2013 at 9:18 pm 1978
The data you posted, is the post meta. From the theme (single.php), you can get the data by using: [php]
Seems like it’s an array, you can view the contents by
I am not sure how is this related with your “Items” taxonomy and what’s exactly wrong happening with the taxonomy?
April 10, 2013 at 5:08 am 1986
Hi Tareq, thanks for the quick reply!
The theme I am currently using is called WP Directory, and it comes with a custom post type called “Item”, which supposedly is the ait-dir-item. The theme has some built-in Google Maps magic that allows you to show a map with a marker, or a streetview in your header.
When creating a new Item, you can select several custom fields, amongst one is the Google Maps/Streetview field.
I would like to have that entire form on the frontend so that people can add their own Items without having to go to the backend of WordPress. I’ve tried setting the meta keys to the ones shown in my previous post (like address etc.) but somehow I’m not writing the variable to the ait-dir-item array.
I’ve set the custom post type in the plugin, so I would’ve thought it would write to the custom post meta keys too. Since it’s an array, would I have to enter anything special in the meta key field?
If you need any more information, let me know :).
April 10, 2013 at 10:41 am 1989
From the plugins built in Google Maps meta field, it’s not possible to save the exact information in exact format as this theme saves. But in can be adapted I guess.
The plugin comes with some actions/filters and with the help of these action/filters you can achieve those. You can use the plugins Google map for taking the data and manipulate it to save it in the themes meta format. Or you can display your themes Geo data meta box in the plugins form and bind to the plugins action hook and save them.
April 10, 2013 at 10:36 pm 2010
Thanks, I’ll give it a try! Not new to programming, but new to PHP so I consider this a good excersize :).
April 13, 2013 at 2:07 am 2124
I just tried and tried again, but it’s still not working.
Tareq, I see for instance that the wpuf_form is also saved as a serialized array. Is there a way to have WP User Frontend Pro save its data in a serialized array somehow, just like wpuf_form?
April 13, 2013 at 2:47 am 2127
The trick you need to use is, when you are submitting the form, all the submitted values can be found in $_POST variable. So binding a function to the action
April 13, 2013 at 6:16 pm 2154
Hi Tareq, thanks for the reply! What you’re saying makes total sense, apart from the fact that I myself aren’t capable of such PHP magic . I don’t want to coerce you into spelling it out entirely for me (although it would be appreciated), but I guess I’ll take a book on PHP and get myself accustomed with WordPress a bit more on the code level and leave the custom post item editing in the backend for now.
Thanks for your help so far though, love the plugin and the level of support!
April 16, 2013 at 7:35 pm 2307
Well… so far nothing new… Although is there a way to add a complete metabox to the frontend in one go? All of the info seems to be saved in _ait-dir-item_metabox
April 16, 2013 at 8:13 pm 2309
Meta box is also a function, so it can be added directly by calling that function to the plugin hook.
April 16, 2013 at 8:16 pm 2311
|retroga_me||This reply has been marked as private.|
April 17, 2013 at 10:24 am 2337
Ok… Here goes:
I got this function:
I pasted that in wpuf-functions.php, then the theme told me I could not redefine that function, so I deleted it from the theme’s functions.php
And it still doesn’t work. Now to be fair, I think I’m hacking too much at it :P.
April 17, 2013 at 12:44 pm 2358
I think you are searching the wrong thing. Can you paste the function that displays the location meta box in the theme?
April 17, 2013 at 1:15 pm 2362
This might be it:
It’s in functions-dir.php of the theme.
Sorry for all the hassle. If I get it to work though, I’ll do my best to promote the plugin with the theme users, since they’re all hoping that I can get it to work with the theme :).
April 17, 2013 at 2:18 pm 2367
You want to show the same meta box to the frontend, right? That’s not the page I was looking for. Wrong file 😉
April 17, 2013 at 2:55 pm 2368
From what I can see they’re using
$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: