Changeset 2916256
- Timestamp:
- 05/23/2023 08:53:09 AM (3 years ago)
- Location:
- ryviu/trunk/includes
- Files:
-
- 2 edited
-
functions.php (modified) (2 diffs)
-
settings.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ryviu/trunk/includes/functions.php
r2915558 r2916256 697 697 // Total shortcode 698 698 699 function ryviu_widget_total_func( $atts ) { 700 $a = shortcode_atts( array( 701 'product_id' => 0 702 ), $atts ); 703 704 ob_start(); 705 706 ryviu_widget_rating_total(); 707 708 return ob_get_clean(); 709 } 699 710 add_shortcode( 'ryviu_widget_total', 'ryviu_widget_total_func' ); 700 711 701 function ryviu_widget_total_func( $atts ) { 702 $atts = shortcode_atts( array( 703 'product_id' => 0, 712 // Reviews shortcode 713 714 function ryviu_widget_sc( $atts ) { 715 $a = shortcode_atts( array( 716 'product_id' => 0 704 717 ), $atts ); 705 718 706 ryviu_widget_rating_total(); 707 } 708 709 // Reviews shortcode 710 719 ob_start(); 720 721 ryviu_product_display_review(); 722 723 return ob_get_clean(); 724 } 711 725 add_shortcode( 'ryviu_widget', 'ryviu_widget_sc' ); 712 726 713 function ryviu_widget_sc( $atts ) { 714 $atts = shortcode_atts( array( 715 'product_id' => 0, 727 // Collection shortcode 728 729 function ryviu_widget_colection_func( $atts ) { 730 $a = shortcode_atts( array( 731 'product_id' => 0 716 732 ), $atts ); 717 733 718 ryviu_product_display_review(); 719 } 720 721 // Collection shortcode 722 734 ob_start(); 735 736 ryviu_widget_rating_total_in_product_category(); 737 738 return ob_get_clean(); 739 } 723 740 add_shortcode( 'ryviu_widget_colection', 'ryviu_widget_colection_func' ); 724 741 725 function ryviu_widget_colection_func( $atts ) {726 $atts = shortcode_atts( array(727 'product_id' => 0,728 ), $atts );729 730 ryviu_widget_rating_total_in_product_category();731 }732 733 742 // Question and answer shortcode 734 735 add_shortcode( 'ryviu_question_and_answer', 'question_and_answer_func' );736 743 737 744 function question_and_answer_func( $atts ) { … … 739 746 'product_id' => 0, 740 747 ), $atts ); 748 ob_start(); 741 749 742 750 ryviu_add_questions_answers_section(); 743 } 751 752 return ob_get_clean(); 753 } 754 755 add_shortcode( 'ryviu_question_and_answer', 'question_and_answer_func' ); -
ryviu/trunk/includes/settings.php
r2915558 r2916256 99 99 ); 100 100 101 add_settings_section(102 'stars_section_id', // ID103 'Star rating', // Title104 array( $this, 'print_stars_info' ), // Callback105 'ryviu-setting-admin' // Page106 );107 108 foreach ($this->star_rating_settings() as $field) {109 add_settings_field(110 $field['name'], // name111 $field['title'], // Title112 array( $this, $field['name'].'_callback' ), // Callback113 'ryviu-setting-admin', // Page114 'stars_section_id' // Section115 );116 }117 118 add_settings_section(119 'ryviu_widget_id', // ID120 'Ryviu widget', // Title121 array( $this, 'print_reviews_info' ), // Callback122 'ryviu-setting-admin' // Page123 );124 125 foreach ($this->reviews_widget_settings() as $field) {126 add_settings_field(127 $field['name'], // name128 $field['title'], // Title129 array( $this, $field['name'].'_callback' ), // Callback130 'ryviu-setting-admin', // Page131 'ryviu_widget_id' // Section132 );133 }134 135 add_settings_section(136 'question_widget_id', // ID137 'Question and answer', // Title138 array( $this, 'print_question_info' ), // Callback139 'ryviu-setting-admin' // Page140 );141 142 foreach ($this->questions_and_answer_settings() as $field) {143 add_settings_field(144 $field['name'], // name145 $field['title'], // Title146 array( $this, $field['name'].'_callback' ), // Callback147 'ryviu-setting-admin', // Page148 'question_widget_id' // Section149 );150 }151 101 152 102 add_settings_section( 153 103 'general_id', // ID 154 ' Othersettings', // Title104 'Ryviu settings', // Title 155 105 array( $this, 'print_section_info' ), // Callback 156 106 'ryviu-setting-admin' // Page … … 167 117 } 168 118 } 169 public function star_rating_settings(){ 119 120 public function general_settings(){ 170 121 $fields = [ 171 122 'position_display_widget' => 'Star rating on product page', 172 123 'show_average_rating' => 'Show average rating', 173 124 'position_display_widget_in_loop' => 'Star rating on collection page', 174 ]; 175 176 return array_map(function($name, $title) { 177 return ['name' => $name, 'title' => $title]; 178 }, array_keys($fields), array_values($fields)); 179 } 180 public function general_settings(){ 181 $fields = [ 125 'position_display' => 'Review box on product page', 126 'custom_tab_title' => 'Title reviews tab', 127 'active_reviews_tab' => 'Default active review tab', 128 'one_column_mobile' => '1 column on mobile', 129 'element_trigger_click' => 'Title reviews tab HTML', 130 'question_and_answer' => 'Question and Answer', 131 'custom_question_tab_title' => 'Title Question & Answer tab', 182 132 'wordpress_theme' => 'Wordpress Theme', 183 133 'data_rocket_status' => 'Cloudfare CDN & Data Rocket', … … 189 139 } 190 140 191 public function reviews_widget_settings(){192 $fields = [193 'position_display' => 'Review box on product page',194 'custom_tab_title' => 'Title reviews tab',195 'active_reviews_tab' => 'Default active review tab',196 'one_column_mobile' => '1 column on mobile',197 'element_trigger_click' => 'Title reviews tab HTML',198 ];199 200 return array_map(function($name, $title) {201 return ['name' => $name, 'title' => $title];202 }, array_keys($fields), array_values($fields));203 }204 205 public function questions_and_answer_settings(){206 $fields = [207 'question_and_answer' => 'Question and Answer',208 'custom_question_tab_title' => 'Title Question & Answer tab',209 ];210 211 return array_map(function($name, $title) {212 return ['name' => $name, 'title' => $title];213 }, array_keys($fields), array_values($fields));214 }215 216 141 public function check_selected($val1 = '1', $val2 = '2'){ 217 142 if($val1 == $val2){ … … 230 155 $new_input = array(); 231 156 232 $star_rating_settings = $this->star_rating_settings(); 233 $general_settings = $this->general_settings(); 234 $reviews_widget_settings = $this->reviews_widget_settings(); 235 $questions_and_answer_settings = $this->questions_and_answer_settings(); 236 237 $fields_setting = array_merge($star_rating_settings, $general_settings, $reviews_widget_settings, $questions_and_answer_settings); 238 157 $fields_setting = $this->general_settings(); 239 158 240 159 $fields_setting[] = array( … … 262 181 */ 263 182 public function print_section_info(){ 264 print ' ';183 print 'Enter your settings below:'; 265 184 } 266 185
Note: See TracChangeset
for help on using the changeset viewer.