| 1 |
<?php |
| 2 |
/** |
| 3 |
* Term Cover Image |
| 4 |
*/ |
| 5 |
|
| 6 |
final class Themify_Term_Images { |
| 7 |
|
| 8 |
public static function run() { |
| 9 |
add_action( 'admin_init', array( __CLASS__, 'admin_init' ), 100 ); |
| 10 |
} |
| 11 |
|
| 12 |
/** |
| 13 |
* Add options to all taxonomy terms that have archives |
| 14 |
*/ |
| 15 |
public static function admin_init() { |
| 16 |
$taxonomies = get_taxonomies( array( 'public' => true ) ); |
| 17 |
foreach ( $taxonomies as $tax ) { |
| 18 |
add_filter( "themify_metabox/taxonomy/{$tax}/fields", array( __CLASS__, 'fields' ) ); |
| 19 |
} |
| 20 |
} |
| 21 |
|
| 22 |
public static function fields( $fields ) { |
| 23 |
$options = array( |
| 24 |
array( |
| 25 |
'name' => 'tbp_cover', |
| 26 |
'title' => __( 'Themify Cover Image', 'themify' ), |
| 27 |
'description' => __( 'This image can be used in various Themify templates, like in Builder Pro archive templates.', 'themify' ), |
| 28 |
'type' => 'image', |
| 29 |
'meta' => array() |
| 30 |
), |
| 31 |
); |
| 32 |
|
| 33 |
return array_merge( $fields, $options ); |
| 34 |
} |
| 35 |
} |
| 36 |
Themify_Term_Images::run(); |