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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user