Add sp_spec CPT for Event Specs

a) Create sp_spec
b) Add it to Config Page
c) Add Admin Meta-Box
d) Add Event Meta-Box
This commit is contained in:
savvasha
2018-02-16 13:53:56 +02:00
parent 87887a38aa
commit fa1877747c
12 changed files with 323 additions and 3 deletions

View File

@@ -707,4 +707,24 @@ class SP_Event extends SP_Custom_Post{
public function sort_timeline( $a, $b ) {
return $a['time'] - $b['time'];
}
/**
* Returns formatted event specs
*
* @access public
* @return array
*/
public function specs( $neg = null ) {
$specs = (array)get_post_meta( $this->ID, 'sp_specs', true );
$spec_labels = (array)sp_get_var_labels( 'sp_spec', $neg, false );
$data = array();
foreach ( $spec_labels as $key => $value ):
$spec = sp_array_value( $specs, $key, null );
if ( $spec == null )
continue;
$data[ $value ] = sp_array_value( $specs, $key, ' ' );
endforeach;
return $data;
}
}