Fix bugs, use plural post slugs, move actions and filters into hooks folder

This commit is contained in:
Brian Miyaji
2014-01-09 02:37:13 +11:00
parent e76d392726
commit bfcf6e9b38
32 changed files with 390 additions and 312 deletions

View File

@@ -0,0 +1,19 @@
<?php
function sportspress_insert_post_data( $data, $postarr ) {
if( $data['post_type'] == 'sp_event' && $data['post_title'] == '' ):
$teams = (array)$postarr['sp_team'];
$team_names = array();
foreach( $teams as $team ):
$team_names[] = get_the_title( $team );
endforeach;
$data['post_title'] = implode( ' ' . __( 'vs', 'sportspress' ) . ' ', $team_names );
endif;
return $data;
}
add_filter( 'wp_insert_post_data' , 'sportspress_insert_post_data' , '99', 2 );