| @@ -477,5 +477,64 @@ | ||
| 477 | 477 | |
| 478 | 478 | // Hook the filter to the wpseo_sitemap_index filter hook |
| 479 | 479 | add_filter('wpseo_sitemap_index', 'wdk_modify_sitemap_index'); |
| 480 | 480 | |
| 481 | +if(false) { | |
| 482 | + // Hook example, custom page title for | |
| 483 | + add_filter( 'document_title_parts', function( $title_parts_array ) { | |
| 484 | + global $wp_query; | |
| 485 | + if(isset($wp_query->post)) | |
| 486 | + if($wp_query->post->post_type == 'wdk-listing') | |
| 487 | + { | |
| 488 | + $wdk_listing_id = $wp_query->post->ID; | |
| 489 | + if($wdk_listing_id) { | |
| 490 | + global $Winter_MVC_WDK; | |
| 491 | + $Winter_MVC_WDK->model('field_m'); | |
| 492 | + $Winter_MVC_WDK->load_helper('listing'); | |
| 493 | + | |
| 494 | + $title_parts_array['title'] = wp_strip_all_tags(wpautop(wdk_field_value('post_title', $wdk_listing_id).' - '.wdk_field_value('address', $wdk_listing_id))); | |
| 495 | + } | |
| 496 | + } | |
| 497 | + return $title_parts_array; | |
| 498 | + } ); | |
| 499 | +} | |
| 500 | + | |
| 501 | +add_filter('tiny_mce_before_init', function($init){ | |
| 502 | + if(get_option('wdk_disable_toolbar_on_content_editor')) { | |
| 503 | + $init['wpautop'] = false; | |
| 504 | + $init['toolbar'] = false; | |
| 505 | + } | |
| 506 | + | |
| 507 | + return $init; | |
| 508 | +}); | |
| 509 | + | |
| 510 | +/* | |
| 511 | +* configuration number_format_i18n | |
| 512 | +*/ | |
| 513 | +add_filter('init', function($init){ | |
| 514 | + if(get_option('wdk_number_format_decimal_point') || get_option('wdk_number_format_thousands_sep')) { | |
| 515 | + global $wp_locale; | |
| 516 | + if(get_option('wdk_number_format_decimal_point')) | |
| 517 | + $wp_locale->number_format['decimal_point'] = get_option('wdk_number_format_decimal_point'); | |
| 518 | + | |
| 519 | + if(get_option('wdk_number_format_thousands_sep')) | |
| 520 | + $wp_locale->number_format['thousands_sep'] = get_option('wdk_number_format_thousands_sep'); | |
| 521 | + } | |
| 522 | +}); | |
| 523 | + | |
| 524 | +add_filter( 'wdk/listings/results', function($listings) { | |
| 525 | + global $Winter_MVC_WDK; | |
| 526 | + $Winter_MVC_WDK->model('field_m'); | |
| 527 | + $Winter_MVC_WDK->load_helper('listing'); | |
| 528 | + | |
| 529 | + $listings_ids = array(); | |
| 530 | + foreach($listings as $listing) { | |
| 531 | + $listings_ids[] = $listing->post_id; | |
| 532 | + } | |
| 533 | + | |
| 534 | + if(!empty($listings_ids)) { | |
| 535 | + $Winter_MVC_WDK->listing_m->update_listings_views($listings_ids); | |
| 536 | + } | |
| 537 | + | |
| 538 | + return $listings; | |
| 539 | +} ) | |
| 481 | 540 | ?> |