Вывод контента с учетом геолокации
-
Greetings! I hope to implement the output of the content of records on the site, taking into account geolocation. For these purposes, I plan to assign automatic assignment of arbitrary fields when publishing records with a value (city of the visitor). For these purposes I apply:
add_action(‘publish_post’, ‘add_custom_field_automatically’);
function add_custom_field_automatically($post_ID) {
global $wpdb;
if(!wp_is_post_revision($post_ID)) {
add_post_meta($post_ID, ‘field-name’, ‘custom value’, true);
}
}
I’m new, and it’s hard for me to understand how to set the ‘custom value’ value for the hidden field ‘field-name’, so that the city value is assigned to the record. As far as I understand, this is not possible for a shortcode.
Then, with the help of the filter, I plan to compare the value in the record and in the work of the plugin and display for the visitor the content on the city of its entrance.Please help to assign the value ‘custom value’ and tell me, can this be implemented with your plugin?
The topic ‘Вывод контента с учетом геолокации’ is closed to new replies.