Changeset 2486853
- Timestamp:
- 03/04/2021 01:49:44 PM (5 years ago)
- Location:
- wp-dlm-faq/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (3 diffs)
-
wp-dlm-faq.php (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-dlm-faq/trunk/readme.txt
r2480121 r2486853 4 4 Requires at least: 5.0 5 5 Tested up to: 5.5 6 Stable tag: 1. 36 Stable tag: 1.4 7 7 License: GPLv2 or later 8 8 … … 15 15 16 16 == Changelog == 17 18 = 1.4 = 19 * add bullets to the new line in asnwers 17 20 18 21 = 1.3 = … … 31 34 == Upgrade notice == 32 35 36 = 1.4 = 37 * add bullets to the new line in asnwers 38 39 = 1.3 = 40 * refine the code to remove the see all button if there is less than 10 questions on a page 41 42 = 1.2 = 43 * refine the code to eliminate extra special chars 44 33 45 = 1.1 = 34 46 Upgrade if you want to have a read more link in the list page as you do not want to have all the faq display at once. -
wp-dlm-faq/trunk/wp-dlm-faq.php
r2480121 r2486853 4 4 * Plugin URI: https://wordpress.org/plugins/wp-dlm-faq/ 5 5 * Description: The plugin used for faq. 6 * Version: 1. 36 * Version: 1.4 7 7 * Author: DLM 8 8 * Author URI: https://dlmconversion.com/wordpress-plugins/ … … 156 156 } 157 157 $faq = get_field($field_name, $id); 158 $faq = str_replace('"', '', str_replace("'", "", str_replace('\"', '', $faq))); 159 $faq = str_replace('{', '{"', str_replace('}', '"}', $faq)); 160 $faq = str_replace(':{', '":{', str_replace(':[{', '":[{', $faq)); 161 162 $faq = str_replace(',answer', '","answer', str_replace('question:', 'question":"', str_replace('answer:', 'answer":"', str_replace('}],', '}],"', $faq)))); 163 $faq = str_replace('}]"},', '}]},"', str_replace('}]"}"}', '}]}}', $faq)); 158 $faq = clean_faqs($faq); 164 159 165 160 $character = json_decode($faq, true); … … 272 267 } 273 268 $faq = get_field($field_name, $id); 274 $faq = str_replace('"', '', str_replace("'", "", str_replace('\"', '', $faq))); 275 $faq = str_replace('{', '{"', str_replace('}', '"}', $faq)); 276 $faq = str_replace(':{', '":{', str_replace(':[{', '":[{', $faq)); 277 278 $faq = str_replace(',answer', '","answer', str_replace('question:', 'question":"', str_replace('answer:', 'answer":"', str_replace('}],', '}],"', $faq)))); 279 $faq = str_replace('}]"},', '}]},"', str_replace('}]"}"}', '}]}}', $faq)); 269 270 echo $faq = clean_faqs($faq); 280 271 $character = json_decode($faq, true); 281 272 if($my_options['id_number']!=1){ … … 298 289 299 290 if("faq-no-".$i == "faq-no-".$my_options['id_number_acc']){ 300 $wrap .= '<div class="faq-item faq-no-'.$i.' nxtall"><h3 class=""><span class="ui-state-active ui-icon"></span>'.str_replace("u2019", "'", $value['question']).'</h3><div style="display: none;"><p>'.str_replace("u2019", "'", str_replace( ".nn", ".<br><br>", $value['answer'])).'</p></div></div>';291 $wrap .= '<div class="faq-item faq-no-'.$i.' nxtall"><h3 class=""><span class="ui-state-active ui-icon"></span>'.str_replace("u2019", "'", $value['question']).'</h3><div style="display: none;"><p>'.str_replace("u2019", "'", str_replace('•', '<br>• ', $value['answer'])).'</p></div></div>'; 301 292 } 302 293 else{ 303 $wrap .= '<div class="faq-item faq-no-'.$i.'"><h3 class=""><span class="ui-state-active ui-icon"></span>'.str_replace("u2019", "'", $value['question']).'</h3><div style="display: none;"><p>'.str_replace("u2019", "'", str_replace( ".nn", ".<br><br>", $value['answer'])).'</p></div></div>';294 $wrap .= '<div class="faq-item faq-no-'.$i.'"><h3 class=""><span class="ui-state-active ui-icon"></span>'.str_replace("u2019", "'", $value['question']).'</h3><div style="display: none;"><p>'.str_replace("u2019", "'", str_replace('•', '<br>• ', $value['answer'])).'</p></div></div>'; 304 295 } 305 296 $i++; … … 320 311 //print_r($value); 321 312 if("faq-no-".$i == "faq-no-".$my_options['id_number_acc']){ 322 $wrap .= '<div class="faq-item faq-no-'.$i.' nxtall"><h3 class=""><span class="ui-state-active ui-icon"></span>'.str_replace("u2019", "'", $value['question']).'</h3><div style="display: none;"><p>'.str_replace("u2019", "'", str_replace( ".nn", ".<br><br>", $value['answer'])).'</p></div></div>';313 $wrap .= '<div class="faq-item faq-no-'.$i.' nxtall"><h3 class=""><span class="ui-state-active ui-icon"></span>'.str_replace("u2019", "'", $value['question']).'</h3><div style="display: none;"><p>'.str_replace("u2019", "'", str_replace('•', '<br>• ', $value['answer'])).'</p></div></div>'; 323 314 } 324 315 else{ 325 $wrap .= '<div class="faq-item faq-no-'.$i.'"><h3 class=""><span class="ui-state-active ui-icon"></span>'.str_replace("u2019", "'", $value['question']).'</h3><div style="display: none;"><p>'.str_replace("u2019", "'", str_replace( ".nn", ".<br><br>", $value['answer'])).'</p></div></div>';316 $wrap .= '<div class="faq-item faq-no-'.$i.'"><h3 class=""><span class="ui-state-active ui-icon"></span>'.str_replace("u2019", "'", $value['question']).'</h3><div style="display: none;"><p>'.str_replace("u2019", "'", str_replace('•', '<br>• ', $value['answer'])).'</p></div></div>'; 326 317 } 327 318 $i++; … … 339 330 //print_r($value); 340 331 if("faq-no-".$i == "faq-no-".$my_options['id_number_acc']){ 341 $wrap .= '<div class="faq-item faq-no-'.$i.' nxtall"><h3 class=""><span class="ui-state-active ui-icon"></span>'.str_replace("u2019", "'", $value['question']).'</h3><div style="display: none;"><p>'.str_replace("u2019", "'", str_replace( ".nn", ".<br><br>", $value['answer'])).'</p></div></div>';332 $wrap .= '<div class="faq-item faq-no-'.$i.' nxtall"><h3 class=""><span class="ui-state-active ui-icon"></span>'.str_replace("u2019", "'", $value['question']).'</h3><div style="display: none;"><p>'.str_replace("u2019", "'", str_replace('•', '<br>• ', $value['answer'])).'</p></div></div>'; 342 333 } 343 334 else{ 344 $wrap .= '<div class="faq-item faq-no-'.$i.'"><h3 class=""><span class="ui-state-active ui-icon"></span>'.str_replace("u2019", "'", $value['question']).'</h3><div style="display: none;"><p>'.str_replace("u2019", "'", str_replace( ".nn", ".<br><br>", $value['answer'])).'</p></div></div>';335 $wrap .= '<div class="faq-item faq-no-'.$i.'"><h3 class=""><span class="ui-state-active ui-icon"></span>'.str_replace("u2019", "'", $value['question']).'</h3><div style="display: none;"><p>'.str_replace("u2019", "'", str_replace('•', '<br>• ', $value['answer'])).'</p></div></div>'; 345 336 } 346 337 $i++; … … 350 341 } 351 342 endif; 343 $wrap .='</div>'; 352 344 if($i>10){ 353 $wrap .='< /div><div class="faq-bottom"><a class="btn btn-gold all-btn" href="#dlm_faq">See All</a></div>';345 $wrap .='<div class="faq-bottom"><a class="btn btn-gold all-btn" href="#dlm_faq">See All</a></div>'; 354 346 } 355 347 … … 400 392 $faq = get_field($field_name, $id); 401 393 402 $faq = str_replace('"', '', str_replace("'", "", str_replace('\"', '', $faq))); 403 $faq = str_replace('{', '{"', str_replace('}', '"}', $faq)); 404 $faq = str_replace(':{', '":{', str_replace(':[{', '":[{', $faq)); 405 406 $faq = str_replace(',answer', '","answer', str_replace('question:', 'question":"', str_replace('answer:', 'answer":"', str_replace('}],', '}],"', $faq)))); 407 $faq = str_replace('}]"},', '}]},"', str_replace('}]"}"}', '}]}}', $faq)); 394 $faq = clean_faqs($faq); 408 395 409 396 $character = json_decode($faq, true); … … 420 407 'acceptedAnswer' => array( 421 408 '@type' => 'Answer', 422 'text' => str_replace("u2019", "'", str_replace(".nn", ".<br><br>", $value['answer']))409 'text' => str_replace("u2019", "'", $value['answer']) 423 410 ) 424 411 ); … … 442 429 'acceptedAnswer' => array( 443 430 '@type' => 'Answer', 444 'text' => str_replace("u2019", "'", str_replace(".nn", ".<br><br>", $value['answer']))431 'text' => str_replace("u2019", "'", $value['answer']) 445 432 ) 446 433 ); … … 461 448 'acceptedAnswer' => array( 462 449 '@type' => 'Answer', 463 'text' => str_replace("u2019", "'", str_replace(".nn", ".<br><br>", $value['answer']))450 'text' => str_replace("u2019", "'", $value['answer']) 464 451 ) 465 452 ); … … 495 482 496 483 $faq = get_field($_REQUEST["title"], $id); 497 $faq = str_replace('"', '', str_replace("'", "", str_replace('\"', '', $faq))); 498 $faq = str_replace('{', '{"', str_replace('}', '"}', $faq)); 499 $faq = str_replace(':{', '":{', str_replace(':[{', '":[{', $faq)); 500 501 $faq = str_replace(',answer', '","answer', str_replace('question:', 'question":"', str_replace('answer:', 'answer":"', str_replace('}],', '}],"', $faq)))); 502 $faq = str_replace('}]"},', '}]},"', str_replace('}]"}"}', '}]}}', $faq)); 484 $faq = clean_faqs($faq); 503 485 $character = json_decode($faq, true); 504 486 … … 522 504 } 523 505 506 function clean_faqs($faq){ 507 $search = array('\"', "'", '"', '{', '}', ':[{', ':{', '}],', 'answer:', 'question:', ',answer', '}]"}"}', '}]"},'); 508 $replace = array('', '', '', '{"', '"}', '":[{', '":{', '}],"', 'answer":"', 'question":"', '","answer', '}]}}', '}]},"'); 509 return str_replace($search, $replace, $faq); 510 } 511 512 524 513 if( is_admin() ) 525 514 $my_settings_page = new MySettingsPage();
Note: See TracChangeset
for help on using the changeset viewer.