*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function opalestate_widgets_init() {
register_sidebar( [
'name' => esc_html__( 'Single Property Sidebar', 'opalestate-pro' ),
'id' => 'opalestate-single-property',
'description' => esc_html__( 'Add widgets here to appear in your single property sidebar area.', 'opalestate-pro' ),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '',
] );
}
add_action( 'widgets_init', 'opalestate_widgets_init' );
/**
* Add hidden multilingual.
*/
function opalestate_add_hidden_multilingual() {
if ( ! opalestate_running_on_multilanguage() ) {
return;
}
?>
'attachment',
'post_status' => 'inherit',
'date_query' => [
'column' => 'post_date',
'before' => date( 'Y-m-d', strtotime( '-1 days' ) ),
],
'meta_query' => [
[
'key' => '_pending_to_use_',
'value' => 1,
'compare' => '>=',
],
],
]
);
if ( $query->have_posts() ) {
while ( $query->have_posts() ) {
$query->the_post();
wp_delete_attachment( get_the_ID() );
}
}
wp_reset_postdata();
// Change status expired properties.
$expired_query = new WP_Query( [
'post_type' => 'opalestate_property',
'post_status' => [ 'pending', 'publish' ],
'meta_query' => [
[
'key' => OPALESTATE_PROPERTY_PREFIX . 'expired_time',
'value' => time(),
'compare' => '<',
'type' => 'NUMERIC',
],
],
] );
opalestate_write_log($expired_query->found_posts);
if ( $expired_query->have_posts() ) {
while ( $expired_query->have_posts() ) {
$expired_query->the_post();
opalestate_write_log(get_the_ID());
wp_update_post( [
'ID' => get_the_ID(),
'post_status' => 'expired',
] );
}
}
wp_reset_postdata();
} catch ( Exception $e ) {
opalestate_write_log( $e->getMessage() );
}
}
add_action( 'opalestate_clean_update', 'opalestate_clean_update' );