Documentatie WordPress plugin koppeling met Realworks

Voorbeelden

Home » WordPress plugin koppeling met Realworks » Documentatie » Filters & hooks » Voorbeelden

Voorbeelden

De onderstaande code kan je plaatsen in het functions.php bestand van het actieve thema.

Status nieuw 14 dagen tonen na publicatie object 

function rw_custom_filter_modify_status_raw( $status, $post_id ) {
    if( $status == 'BESCHIKBAAR' ) {
        $date = date_create( get_the_date( 'c', $post_id ) );
        $date_ago = date_create( '14 days ago' );

        if( $date > $date_ago ) {
            $status = 'NIEUW';
        }
    }

    return $status;
}
add_filter( 'rw_makelaar_status_raw', 'rw_custom_filter_modify_status_raw', 10, 2 );

function rw_custom_filter_modify_status( $status, $status_raw, $post_id ) {
    if( $status_raw == 'BESCHIKBAAR' ) {
        $date = date_create( get_the_date( 'c', $post_id ) );
        $date_ago = date_create( '14 days ago' );

        if( $date > $date_ago ) {
            $status = 'Nieuw';
        }
    }

    return $status;
}
add_filter( 'rw_makelaar_status', 'rw_custom_filter_modify_status', 10, 3 );

Status aanpassen naar open huis en de datum tonen

function rw_custom_filter_plugin_open_huis_status( $status, $status_raw, $post_id ) {
    if ( $status_raw == 'BESCHIKBAAR' ) {

        if ( is_archive() ) {
            $openhuis = rw_get_meta( 'openhuis', $post_id );

            if ( ! empty( $openhuis ) ) {
                $status = 'Open huis';

                $openhuis_start = rw_get_meta( 'openhuis_start', $post_id );
                if ( ! empty( $openhuis_start ) ) {
                    $status .= ' ' . wp_date( 'j F', date_create( $openhuis_start )->format( 'U' ) );
                }
            }

        }
    }

    return $status;
}
add_filter( 'rw_makelaar_status', 'rw_custom_filter_open_huis_status', 11, 3 );

 

 

 

Plugin aanschaffen?

Kies een abonnementsvorm hieronder

€ 199,50 per jaar
  • Onbeperkt aantal objecten
  • Onbeperkt aantal koppelingen (kantoren)
  • 4x per dag bijwerken en/of realtime via Webhooks
  • Koppel met wonen, bedrijven, nieuwbouw en aankoop API

Gefactureerd per jaar tot opzegging