PluginProbe
WP Directory Kit / 1.4.8
WP Directory Kit v1.4.8
1.5.9 1.5.7 1.5.6 1.5.5 1.5.4 1.5.3 trunk 1.1.0 1.1.6 1.1.8 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.8 All 37 releases
← All changes | filters.php +83 -1 1.2.7 → 1.4.8 View file →
@@ -140,9 +140,9 @@
140 140 } else {
141 141 $content = '<div style="margin: 35px auto;max-width:768px"><p class="wdk_alert wdk_alert-danger">'.esc_html__('Listing missing or not activated', 'wpdirectorykit').', <a href="'.get_home_url().'">'.esc_html__('return to Homepage', 'wpdirectorykit').'</a></p></div>';
142 142 }
143 143 } else {
144 - $content = '<div style="margin: 35px auto;max-width:768px"><p class="wdk_alert wdk_alert-danger">'.esc_html__('Missing listing Preview Page', 'wpdirectorykit').', <a href="'.get_admin_url().'admin.php?page=wdk_settings&function=import_demo">'.esc_html__('Import demo Page', 'wpdirectorykit').'</a></p></div>';
144 + $content = '<div style="margin: 35px auto;max-width:768px"><p class="wdk_alert wdk_alert-danger">'.esc_html__('Missing listing Preview Page', 'wpdirectorykit').', <a href="'.esc_url(get_admin_url()).'admin.php?page=wdk_settings&function=import_demo">'.esc_html__('Import demo Page', 'wpdirectorykit').'</a></p></div>';
145 145 }
146 146
147 147 }
148 148 return $content;
@@ -454,5 +454,87 @@
454 454 return $links;
455 455 }
456 456
457 457
458 +add_filter( 'wpdirectorykit/listing/field/value', 'wdk_filter_field_format_date', 2, 10);
459 +if(!function_exists('wdk_filter_field_format_date')) {
460 + function wdk_filter_field_format_date ($field_value = '', $field_id = NULL, $number_format = TRUE) {
461 + if(in_array($field_id, array('date', 'date-modified'))) {
462 + $field_value = wdk_get_date($field_value, TRUE);
463 + }
464 +
465 + return $field_value;
466 + }
467 +}
468 +
469 +
470 +// fix sitemap issue
471 +function wdk_modify_sitemap_index($content) {
472 + // Modify the $content as needed
473 + // For example, replace & with &amp;
474 + $content = str_replace('&', '&amp;', $content);
475 + return $content;
476 +}
477 +
478 +// Hook the filter to the wpseo_sitemap_index filter hook
479 +add_filter('wpseo_sitemap_index', 'wdk_modify_sitemap_index');
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 +} )
458 540 ?>