// Schedule cron (once) add_action('init', function () { if (! wp_next_scheduled('update_tablepress_from_sheets')) { wp_schedule_event(time(), 'hourly', 'update_tablepress_from_sheets'); } }); // Cron callback – NO CLOSURE function stator_update_tablepress_from_sheets() { $table_id = '3'; $csv_url = 'https://docs.google.com/spreadsheets/d/e/2PACX-1vThxWxuxVZIkrQKTy72jfe2dqI48SRq9cAO5it-rdhBjimLHPmhA04YfP9wR-Xq3FtZm2wMDZz507iz/pub?output=csv'; $response = wp_remote_get($csv_url); if (is_wp_error($response)) { error_log('TablePress Sync Error: ' . $response->get_error_message()); return; } $csv_data = wp_remote_retrieve_body($response); if (empty($csv_data)) { error_log('TablePress Sync Error: Empty CSV'); return; } $rows = array_map('str_getcsv', explode("\n", trim($csv_data))); if (class_exists('TablePress')) { $model_table = TablePress::$model_table; $model_table->save(array( 'id' => $table_id, 'data' => $rows, )); } } add_action('update_tablepress_from_sheets', 'stator_update_tablepress_from_sheets');
| 113 | Lamela 2 - Stan broj 21 - dvosoban 37,63m² | Prodat | ||
| 114 | Lamela 2 - Stan broj 22 - dvosoban 37,53m² | Prodat | ||
| 115 | Lamela 2 - Stan broj 23 - garsonjera 25,46m² | Prodat | ||
| 116 | Lamela 2 - Stan broj 24 - dvosoban 42,40m² | Prodat | ||
| 117 | Lamela 2 - Stan broj 25 - dvosoban 44,62m² | Prodat | ||
| 118 | Lamela 2 - Stan broj 26 - dvosoban 44,99m² | Prodat | ||
| 119 | Lamela 2 - Stan broj 27 - dvosoban 45,09m² | Prodat | ||
| 120 | Lamela 2 - Stan broj 28 - trosoban 68,87m² | Prodat | ||
| 121 | Lamela 2 - Stan broj 29 - trosoban 63,27m² | Prodat | ||
| 122 | Lamela 2 - Stan broj 30 - garsonjera 28,93m² | Prodat |