Skip to content

Commit

Permalink
Merge pull request #2735 from 1naveengiri/improvement/2734
Browse files Browse the repository at this point in the history
Add option to detect current CPT and show listing based on it
  • Loading branch information
kprajapatii authored Nov 29, 2024
2 parents c11b686 + efa99d8 commit 481cec0
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion includes/widgets/class-geodir-widget-recently-viewed.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,14 @@ public function set_arguments() {
'advanced' => true
);


$widget_args['use_viewing_post_type'] = array(
'title' => __("Use current viewing post type?", 'geodirectory'),
'type' => 'checkbox',
'desc_tip' => true,
'value' => '1',
'default' => '0',
'advanced' => true,
);
// not needed in AUI
if(!$design_style){
$widget_args['enqueue_slider'] = array(
Expand Down Expand Up @@ -292,6 +299,15 @@ public function output( $args = array(), $widget_args = array(), $content = '' )
if ( ! geodir_is_gd_post_type( $post_type ) ) {
$post_type = 'gd_place';
}
$use_viewing_post_type = ! empty( $args['use_viewing_post_type'] ) ? true : false;
// set post type to current viewing post type
if ( $use_viewing_post_type ) {
$current_post_type = geodir_get_current_posttype();
if ( $current_post_type != '' && $current_post_type != $post_type ) {
$post_type = $current_post_type;
}
}

$enqueue_slider = ! empty( $args['enqueue_slider'] ) ? true : false;

// Elementor pro
Expand Down

0 comments on commit 481cec0

Please sign in to comment.