Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add to api sp_latitude and sp_longitude? #447

Open
kruzikruz opened this issue Aug 5, 2023 · 1 comment
Open

How to add to api sp_latitude and sp_longitude? #447

kruzikruz opened this issue Aug 5, 2023 · 1 comment

Comments

@kruzikruz
Copy link

How to add sp_latitude and sp_longitude so that the data is visible in the api?

@robaduncan
Copy link

Try following this advice I received from Themeboy support:

I've created code that adds the address information into the REST API response you are using. Here's the code snippet:

<?php
 /**
  * Add address information to the REST API route `wp-json/sportspress/v2/venues`.
  */
 add_filter('rest_prepare_sp_venue', function ($data, $term, $request) {
     $data->data['custom_meta'] = get_option("taxonomy_$term->term_id");
     return $data;
 }, 10, 3);

I recommend you inject this code into your website using the Code Snippets plugin. But, that's up to you.

Thanks,
Nabil

I tried this and it worked for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants