diff --git a/assets/css/all-listings.css b/assets/css/all-listings.css index aed5476e11..34e17ed5fb 100644 --- a/assets/css/all-listings.css +++ b/assets/css/all-listings.css @@ -11734,6 +11734,18 @@ input.directorist-toggle-input:checked + .directorist-toggle-input-label span.di color: #fff; } +.directorist-single-dummy-shortcode { + width: 100%; + background-color: #556166; + color: #fff; + margin: 10px 0; + text-align: center; + padding: 40px 10px; + font-weight: 700; + font-size: 16px; + line-height: 1.2; +} + .directorist-signle-listing-top { margin-bottom: 15px; } diff --git a/assets/css/all-listings.rtl.css b/assets/css/all-listings.rtl.css index 667e4572e5..87ca51b700 100644 --- a/assets/css/all-listings.rtl.css +++ b/assets/css/all-listings.rtl.css @@ -11723,6 +11723,18 @@ input.directorist-toggle-input:checked + .directorist-toggle-input-label span.di color: #fff; } +.directorist-single-dummy-shortcode { + width: 100%; + background-color: #556166; + color: #fff; + margin: 10px 0; + text-align: center; + padding: 40px 10px; + font-weight: 700; + font-size: 16px; + line-height: 1.2; +} + .directorist-signle-listing-top { margin-bottom: 15px; } diff --git a/assets/css/public-main.css b/assets/css/public-main.css index 215ea4c1c7..2d8f4bd992 100644 --- a/assets/css/public-main.css +++ b/assets/css/public-main.css @@ -11734,6 +11734,18 @@ input.directorist-toggle-input:checked + .directorist-toggle-input-label span.di color: #fff; } +.directorist-single-dummy-shortcode { + width: 100%; + background-color: #556166; + color: #fff; + margin: 10px 0; + text-align: center; + padding: 40px 10px; + font-weight: 700; + font-size: 16px; + line-height: 1.2; +} + .directorist-signle-listing-top { margin-bottom: 15px; } diff --git a/assets/css/public-main.rtl.css b/assets/css/public-main.rtl.css index 667e4572e5..87ca51b700 100644 --- a/assets/css/public-main.rtl.css +++ b/assets/css/public-main.rtl.css @@ -11723,6 +11723,18 @@ input.directorist-toggle-input:checked + .directorist-toggle-input-label span.di color: #fff; } +.directorist-single-dummy-shortcode { + width: 100%; + background-color: #556166; + color: #fff; + margin: 10px 0; + text-align: center; + padding: 40px 10px; + font-weight: 700; + font-size: 16px; + line-height: 1.2; +} + .directorist-signle-listing-top { margin-bottom: 15px; } diff --git a/assets/js/admin-main.js b/assets/js/admin-main.js index 0b3b59eb90..9caa4c1e0b 100644 --- a/assets/js/admin-main.js +++ b/assets/js/admin-main.js @@ -524,12 +524,12 @@ window.addEventListener('DOMContentLoaded', function () { ); return $elem; } - $("#category_icon").select2({ + $("#category_icon").select2({ placeholder: directorist_admin.i18n_text.icon_choose_text, allowClear: true, templateResult: selecWithIcon, }); - /* Show and hide manual coordinate input field */ + /* Show and hide manual coordinate input field */ if (!$('input#manual_coordinate').is(':checked')) { $('.directorist-map-coordinates').hide(); @@ -1026,11 +1026,11 @@ window.addEventListener('DOMContentLoaded', function () { }); /* // Display the media uploader when "Upload Image" button clicked in the custom taxonomy "atbdp_categories" $( '#atbdp-categories-upload-image' ).on( 'click', function( e ) { - if (frame) { + if (frame) { frame.open(); return; } - // Create a new media frame + // Create a new media frame frame = wp.media({ title: directorist_admin.i18n_text.upload_cat_image, button: { diff --git a/assets/src/scss/component/listing-details/_general.scss b/assets/src/scss/component/listing-details/_general.scss index a786a8cb2e..9c400f0667 100644 --- a/assets/src/scss/component/listing-details/_general.scss +++ b/assets/src/scss/component/listing-details/_general.scss @@ -174,4 +174,16 @@ } } } -} \ No newline at end of file +} + +.directorist-single-dummy-shortcode { + width: 100%; + background-color: #556166; + color: #fff; + margin: 10px 0; + text-align: center; + padding: 40px 10px; + font-weight: 700; + font-size: 16px; + line-height: 1.2; + } \ No newline at end of file diff --git a/includes/class-helper.php b/includes/class-helper.php index c0c2f7d74c..b3219ca9f7 100644 --- a/includes/class-helper.php +++ b/includes/class-helper.php @@ -537,9 +537,23 @@ public static function featured_badge_text() { return get_directorist_option('feature_badge_text', 'Featured'); } + public static function single_listing_dummy_shortcode( $shortcode, $atts = [] ) { + $atts_string = ''; + + if ( $atts ) { + foreach ( $atts as $key => $value ) { + $atts_string .= sprintf( ' %s="%s"', $key, $value ); + } + } + + return sprintf( '
%s%s
', $shortcode, $atts_string ); + } + /** * Get a list of directories that has custom single listing page enabled and set. * + * @todo remove this unused method + * * @param int|null $page_id Optional page id. * * @return array diff --git a/includes/classes/class-shortcode.php b/includes/classes/class-shortcode.php index 6723f9e695..8985aa14c9 100644 --- a/includes/classes/class-shortcode.php +++ b/includes/classes/class-shortcode.php @@ -75,11 +75,11 @@ public function __construct() { return self::$instance; } - // single_listings_header public function single_listings_header( $atts ) { + // Render dummy shortcode content when user isn't in single listing page if ( !is_singular( ATBDP_POST_TYPE ) ) { - return ''; + return Helper::single_listing_dummy_shortcode( 'directorist_single_listings_header', $atts ); } $listing_id = ( isset( $atts['post_id'] ) && is_numeric( $atts['post_id'] ) ) ? ( int ) esc_attr( $atts['post_id'] ) : 0; @@ -107,6 +107,12 @@ public function single_listings_header( $atts ) { } public function single_listing_section( $atts = array() ) { + + // Render dummy shortcode content when user isn't in single listing page + if ( !is_singular( ATBDP_POST_TYPE ) ) { + return Helper::single_listing_dummy_shortcode( 'directorist_single_listing_section', $atts ); + } + $listing_id = ( isset( $atts['post_id'] ) && is_numeric( $atts['post_id'] ) ) ? ( int ) esc_attr( $atts['post_id'] ) : 0; if ( ! $listing_id ) { diff --git a/includes/classes/class-template-hooks.php b/includes/classes/class-template-hooks.php index d3c3d23a7f..82b6fe2c56 100644 --- a/includes/classes/class-template-hooks.php +++ b/includes/classes/class-template-hooks.php @@ -87,12 +87,6 @@ public static function single_content( $content ) { return Helper::get_template_contents( 'single-contents' ); } - $directory_types = Helper::get_directory_types_with_custom_single_page( get_the_ID() ); - if ( get_post_type() === 'page' && ! empty( $directory_types ) ) { - $directory_names = wp_list_pluck( $directory_types, 'name' ); - return sprintf( __( '

This page is currently selected as single Listing details page for %s directory.

', 'directorist' ) , implode( ', ', $directory_names ) ); - } - return $content; }