// 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');
| 153 | Lamela 2 - Stan broj 61 - dvosoban 37,63m² | Za prodaju | ||
| 154 | Lamela 2 - Stan broj 62 - dvosoban 37,53m² | Za prodaju | ||
| 155 | Lamela 2 - Stan broj 63 - garsonjera 25,46m² | Za prodaju | ||
| 156 | Lamela 2 - Stan broj 64 - dvosoban 40,55m² | Za prodaju | ||
| 157 | Lamela 2 - Stan broj 65 - dvosoban 43,80m² | Za prodaju | ||
| 158 | Lamela 2 - Stan broj 66 - dvosoban 44,36m² | Za prodaju | ||
| 159 | Lamela 2 - Stan broj 67 - dvosoban 44,19m² | Za prodaju | ||
| 160 | Lamela 2 - Stan broj 68 - trosoban 68,49m² | Za prodaju | ||
| 161 | Lamela 2 - Stan broj 69 - trosoban 63,27m² | Za prodaju | ||
| 162 | Lamela 2 - Stan broj 70 - garsonjera 28,93m² | Za prodaju |