WordPress Plugin ts-immo-sync

Integrate your Ts-Immo real estate listings directly in WordPress with automatic synchronization, shortcodes, and hooks.

Overview

ts-immo-sync is a WordPress plugin that connects your site to the Ts-Immo platform. It automatically syncs your real estate listings, generates detail pages, and provides shortcodes to display your ads anywhere on your site.

Requirements: WordPress 5.8+, PHP 7.4+, WooCommerce (optionnel)

Installation

Install the plugin via WP-CLI or by downloading the archive from your Ts-Immo client area:

# Via WP-CLI
wp plugin install ts-immo-sync --activate

# Ou télécharger le .zip et installer via
# Tableau de bord WordPress > Extensions > Téléverser

After activation, go to Settings > Ts-Immo Sync to configure your API key.

Configuration

Configure the plugin via the graphical interface or directly in wp-config.php:

// wp-config.php ou via l'interface admin
define('TS_IMMO_API_KEY', 'votre-cle-api');
define('TS_IMMO_API_URL', 'https://api.ts-immo.org/v1');
define('TS_IMMO_SYNC_INTERVAL', 300); // secondes

Shortcodes

Use these shortcodes in your WordPress pages, posts, or widgets:

// Afficher la liste des propriétés
[ts_immo_listings limit="12" type="sale"]

// Afficher une propriété spécifique
[ts_immo_property id="123"]

// Formulaire de recherche
[ts_immo_search fields="type,price,location"]

// Carte interactive
[ts_immo_map zoom="12" lat="48.8566" lng="2.3522"]

Actions & Filters

Extend the plugin behavior using WordPress hooks:

// Action : après synchronisation
add_action('ts_immo_after_sync', function($properties) {
    foreach ($properties as $property) {
        // Traitement personnalisé
        error_log('Sync: ' . $property->id);
    }
});

// Filtre : modifier les données avant import
add_filter('ts_immo_before_import', function($data) {
    $data['custom_field'] = 'valeur';
    return $data;
});

// Action : propriété créée
add_action('ts_immo_property_created', function($post_id, $property) {
    // Notifier, envoyer email, etc.
}, 10, 2);

Synchronization

Synchronization runs automatically at the configured interval (default: every 5 minutes). You can also trigger it manually:

Use dryRun mode to test synchronization without modifying your WordPress data.
// Forcer une synchronisation manuelle via WP-CLI
wp ts-immo sync --all

// Synchroniser un seul bien
wp ts-immo sync --id=456

// Voir le statut de la dernière synchronisation
wp ts-immo status

Template Customization

Copy templates to your child theme to customize them without risking updates:

// Dans votre thème enfant : copier et personnaliser
wp-content/
  themes/
    mon-theme-enfant/
      ts-immo/
        listing.php        // Liste des propriétés
        single.php         // Fiche propriété
        search-form.php    // Formulaire de recherche
        map.php            // Carte

Troubleshooting

If you encounter issues, enable debug mode in the plugin settings to see detailed logs.

Disable debug mode in production — logs may contain sensitive information.