// 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');
| 41 | Lamela 1 - Stan broj 41 - garsonjera 28,19m² | Za prodaju | ||
| 42 | Lamela 1 - Stan broj 42 - dvosoban 41,72m² | Za prodaju | ||
| 43 | Lamela 1 - Stan broj 43 - dvosoban 36,46m² | Prodat | ||
| 44 | Lamela 1 - Stan broj 44 - dvosoban 43,66m² | Za prodaju | ||
| 45 | Lamela 1 - Stan broj 45 - dvosoban 40,54m² | Za prodaju | ||
| 46 | Lamela 1 - Stan broj 46 - trosoban 50,92m² | Prodat | ||
| 47 | Lamela 1 - Stan broj 47 - trosoban 61,59m² | Prodat | ||
| 48 | Lamela 1 - Stan broj 48 - dvosoban 45,08m² | Prodat | ||
| 49 | Lamela 1 - Stan broj 49 - dvosoban 37,55m² | Za prodaju | ||
| 50 | Lamela 1 - Stan broj 50 - dvosoban 34,89m² | Prodat |