Want to tag location to the questions

5.87K viewsUpdates
0

Im wondering how to tag location to the anspress questions. Ideally, I need a map on ASK page where users can select their location. This location tag will be later used as a filtering option.

 

Let me know hoe this can be achieved.

 

Ashvam

0

Try this:

add_action( 'ap_after_new_question', 'my_tag_location_on_new_question' );
function my_tag_location_on_new_question($question_id){
    // Replace YOUR LOCATION HERE with your actual location.
    add_post_meta($question_id, '__question_location', 'YOUR LOCATION HERE');
}
0

You can simply store location as post meta.

commented on answer

How do you store items as post meta?

Yeah, I would also love to do this, and there are plenty of plugins that allow you to geolocate individual posts (which I believe store the location as post meta), but I can’t figure out how to get this functionality to appear on the Ask page in Anspress. ?? Thanks!

Since this question relates to my issue I thought posting here is better than opening a new one.

I’m trying to create a location based q&a section inside a buddypress driven community site, where users would be able to create location based posts, where we would also showcase questions related to the location of the destination page or post.

Part of the idea would be that users should be able to search for a location (country/city) and see q&a related to the location. And as mentioned when looking at a destination page (ex. London) we would like to display questions related to this location.

What would be the best method to go about this?

Thanks in advance!

Hello there- we’d be interested in a solution for this as well. At the moment we use ‘category’ as location, as a temporary workaround.

do you use countries or cities? we plan to have a continent – country – city hierarchy. something similar to https://www.lonelyplanet.com/thorntree/categories/country-forums but maybe with a different way of filtering.