Add custom sidebar for single property

This commit is contained in:
Hoang Huu 2020-02-14 09:38:54 +07:00
parent 50c6d4d421
commit 7a4f3b67dc
7 changed files with 518 additions and 352 deletions

View File

@ -1,3 +1,6 @@
= 1.3.1 - 2020-02-14 =
* Added - Single Property Custom Sidebar.
= 1.3 - 2020-02-10 = = 1.3 - 2020-02-10 =
* Added - Expiry date column. * Added - Expiry date column.

View File

@ -1068,7 +1068,7 @@ function opalestate_areasize_unit_format( $value = '' ) {
$unit = $measurement_units[ $unit ]; $unit = $measurement_units[ $unit ];
} }
return sprintf( _x( '%1$s <span>%2$s</span>', 'areasize info','opalestate-pro' ), $value, $unit ); return sprintf( _x( '%1$s <span>%2$s</span>', 'areasize info', 'opalestate-pro' ), $value, $unit );
} }
add_filter( 'opalestate_areasize_unit_format', 'opalestate_areasize_unit_format' ); add_filter( 'opalestate_areasize_unit_format', 'opalestate_areasize_unit_format' );
@ -1315,17 +1315,37 @@ function opalestate_clean( $var ) {
* with the optional prefix. As such the returned value is not universally unique, * with the optional prefix. As such the returned value is not universally unique,
* but it is unique across the life of the PHP process. * but it is unique across the life of the PHP process.
* *
* @param string $prefix Prefix for the returned ID.
* @return string Unique ID.
* @see wp_unique_id() Themes requiring WordPress 5.0.3 and greater should use this instead. * @see wp_unique_id() Themes requiring WordPress 5.0.3 and greater should use this instead.
* *
* @staticvar int $id_counter * @staticvar int $id_counter
* *
* @param string $prefix Prefix for the returned ID.
* @return string Unique ID.
*/ */
function opalestate_unique_id( $prefix = '' ) { function opalestate_unique_id( $prefix = '' ) {
static $id_counter = 0; static $id_counter = 0;
if ( function_exists( 'wp_unique_id' ) ) { if ( function_exists( 'wp_unique_id' ) ) {
return wp_unique_id( $prefix ); return wp_unique_id( $prefix );
} }
return $prefix . (string) ++$id_counter; return $prefix . (string) ++$id_counter;
} }
/**
* 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' => '<div id="%1$s" class="widget opalestate-single-property-widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h5 class="widget-title">',
'after_title' => '</h5>',
] );
}
add_action( 'widgets_init', 'opalestate_widgets_init' );

View File

@ -330,3 +330,16 @@ function opalestate_load_plugin_template( $template ) {
add_filter( 'template_include', 'opalestate_load_plugin_template' ); add_filter( 'template_include', 'opalestate_load_plugin_template' );
add_action( 'opalestate_before_property_loop_item', 'opalestate_property_featured_label' ); add_action( 'opalestate_before_property_loop_item', 'opalestate_property_featured_label' );
add_action( 'opalestate_before_property_loop_item', 'opalestate_property_label' ); add_action( 'opalestate_before_property_loop_item', 'opalestate_property_label' );
/**
* Add custom sidebar widgets to single property sidebar.
*/
function opalestate_single_property_sidebar_widgets() {
if ( is_active_sidebar( 'opalestate-single-property' ) ) : ?>
<div class="opalestate-single-property-widgets">
<?php dynamic_sidebar( 'opalestate-single-property' ); ?>
</div>
<?php endif;
}
add_action( 'opalestate_single_property_sidebar', 'opalestate_single_property_sidebar_widgets', 99 );

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
* Plugin Name: Opal Estate Pro * Plugin Name: Opal Estate Pro
* Plugin URI: https://wpdocs.gitbook.io/opal-estate/ * Plugin URI: https://wpdocs.gitbook.io/opal-estate/
* Description: Opal Real Estate Plugin is an ideal solution and brilliant choice for you to set up a professional estate website. * Description: Opal Real Estate Plugin is an ideal solution and brilliant choice for you to set up a professional estate website.
* Version: 1.3 * Version: 1.3.1
* Author: WPOPAL * Author: WPOPAL
* Author URI: http://www.wpopal.com * Author URI: http://www.wpopal.com
* Requires at least: 4.9 * Requires at least: 4.9
@ -150,7 +150,7 @@ if ( ! class_exists( 'OpalEstate' ) ) {
*/ */
public function __clone() { public function __clone() {
// Cloning instances of the class is forbidden // Cloning instances of the class is forbidden
_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; huh?', 'opalestate-pro' ), '1.3' ); _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; huh?', 'opalestate-pro' ), '1.3.1' );
} }
/** /**
@ -159,7 +159,7 @@ if ( ! class_exists( 'OpalEstate' ) ) {
public function setup_constants() { public function setup_constants() {
// Plugin version // Plugin version
if ( ! defined( 'OPALESTATE_VERSION' ) ) { if ( ! defined( 'OPALESTATE_VERSION' ) ) {
define( 'OPALESTATE_VERSION', '1.3' ); define( 'OPALESTATE_VERSION', '1.3.1' );
} }
// Plugin Folder Path // Plugin Folder Path

View File

@ -4,7 +4,7 @@ Donate link: https://wpdocs.gitbook.io/opal-estate/
Tags: estate, property, opalestate, house for rent, agency for lease, estate submission, agents estate property, property marketplace Tags: estate, property, opalestate, house for rent, agency for lease, estate submission, agents estate property, property marketplace
Requires at least: 4.9 Requires at least: 4.9
Tested up to: 5.3.2 Tested up to: 5.3.2
Stable tag: 1.3 Stable tag: 1.3.1
License: GPLv3 License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html License URI: http://www.gnu.org/licenses/gpl-3.0.html
@ -156,6 +156,9 @@ This section describes how to install the plugin and get it working.
* System tickets support 24/7 available : [free support](https://wpopal.ticksy.com/ "Visit the Plugin support Page") * System tickets support 24/7 available : [free support](https://wpopal.ticksy.com/ "Visit the Plugin support Page")
== Changelog == == Changelog ==
= 1.3.1 - 2020-02-14 =
* Added - Single Property Custom Sidebar.
= 1.3 - 2020-02-10 = = 1.3 - 2020-02-10 =
* Added - Expiry date column. * Added - Expiry date column.

View File

@ -13,7 +13,7 @@ $type = OpalEstate()->session->get( 'submission' );
<h5><?php esc_html_e( 'Thanks for your submission, it takes some time to review the property.', 'opalestate-pro' ); ?></h5> <h5><?php esc_html_e( 'Thanks for your submission, it takes some time to review the property.', 'opalestate-pro' ); ?></h5>
<?php endif; ?> <?php endif; ?>
<?php echo sprintf( esc_html__( 'Click to %s here %s to back to your listing or %s edit %s this.', 'opalestate-pro' ), <?php echo sprintf( esc_html__( 'Click %s here %s to view your listing or %s edit %s this.', 'opalestate-pro' ),
'<a href="' . opalestate_submssion_list_page() . '">', '</a>', '<a href="' . opalestate_submssion_list_page() . '">', '</a>',
'<a href="' . opalestate_submssion_page( $post_id ) . '">', '</a>' '<a href="' . opalestate_submssion_page( $post_id ) . '">', '</a>'
); ?> ); ?>
@ -21,7 +21,7 @@ $type = OpalEstate()->session->get( 'submission' );
<?php else : ?> <?php else : ?>
<div class="edit-msg"> <div class="edit-msg">
<?php esc_html_e( 'Your property is completed success.', 'opalestate-pro' ); ?> <?php esc_html_e( 'Your property is completed success.', 'opalestate-pro' ); ?>
<?php echo sprintf( esc_html__( 'Click to %s here %s to back to your listing or %s edit %s this.', 'opalestate-pro' ), <?php echo sprintf( esc_html__( 'Click %s here %s to view your listing or %s edit %s this.', 'opalestate-pro' ),
'<a href="' . opalestate_submssion_list_page() . '">', '</a>', '<a href="' . opalestate_submssion_list_page() . '">', '</a>',
'<a href="' . opalestate_submssion_page( $post_id ) . '">', '</a>' '<a href="' . opalestate_submssion_page( $post_id ) . '">', '</a>'
); ?> ); ?>