| 1 |
<?php |
| 2 |
|
| 3 |
class WPUPG_Meta_Box { |
| 4 |
|
| 5 |
public function __construct() |
| 6 |
{ |
| 7 |
add_action( 'admin_init', array( $this, 'add_meta_box' ), 10 ); |
| 8 |
add_action( 'admin_init', array( $this, 'add_meta_box_data_source' ), 12 ); |
| 9 |
add_action( 'admin_init', array( $this, 'add_meta_box_filter' ), 14 ); |
| 10 |
add_action( 'admin_init', array( $this, 'add_meta_box_grid' ), 16 ); |
| 11 |
add_action( 'admin_init', array( $this, 'add_meta_box_pagination' ), 18 ); |
| 12 |
} |
| 13 |
|
| 14 |
public function add_meta_box() |
| 15 |
{ |
| 16 |
add_meta_box( |
| 17 |
'wpupg_meta_box_shortcode', |
| 18 |
__( 'Shortcode', 'wp-ultimate-post-grid' ), |
| 19 |
array( $this, 'meta_box_shortcode' ), |
| 20 |
WPUPG_POST_TYPE, |
| 21 |
'side', |
| 22 |
'high' |
| 23 |
); |
| 24 |
|
| 25 |
if( !WPUltimatePostGrid::is_premium_active() ) { |
| 26 |
add_meta_box( |
| 27 |
'wpupg_meta_box_premium_only', |
| 28 |
__( 'Premium Only', 'wp-ultimate-post-grid' ), |
| 29 |
array( $this, 'meta_box_premium_only' ), |
| 30 |
WPUPG_POST_TYPE, |
| 31 |
'side', |
| 32 |
'default' |
| 33 |
); |
| 34 |
} |
| 35 |
} |
| 36 |
|
| 37 |
public function add_meta_box_data_source() |
| 38 |
{ |
| 39 |
add_meta_box( |
| 40 |
'wpupg_meta_box_data_source', |
| 41 |
__( 'Data Source', 'wp-ultimate-post-grid' ), |
| 42 |
array( $this, 'meta_box_data_source' ), |
| 43 |
WPUPG_POST_TYPE, |
| 44 |
'normal', |
| 45 |
'high' |
| 46 |
); |
| 47 |
|
| 48 |
add_meta_box( |
| 49 |
'wpupg_meta_box_limit_posts', |
| 50 |
__( 'Limit Posts', 'wp-ultimate-post-grid' ), |
| 51 |
array( $this, 'meta_box_limit_posts' ), |
| 52 |
WPUPG_POST_TYPE, |
| 53 |
'normal', |
| 54 |
'high' |
| 55 |
); |
| 56 |
} |
| 57 |
|
| 58 |
public function add_meta_box_filter() |
| 59 |
{ |
| 60 |
add_meta_box( |
| 61 |
'wpupg_meta_box_filter', |
| 62 |
__( 'Filter', 'wp-ultimate-post-grid' ), |
| 63 |
array( $this, 'meta_box_filter' ), |
| 64 |
WPUPG_POST_TYPE, |
| 65 |
'normal', |
| 66 |
'high' |
| 67 |
); |
| 68 |
|
| 69 |
add_meta_box( |
| 70 |
'wpupg_meta_box_isotope_filter', |
| 71 |
__( 'Isotope Filter', 'wp-ultimate-post-grid' ), |
| 72 |
array( $this, 'meta_box_isotope_filter' ), |
| 73 |
WPUPG_POST_TYPE, |
| 74 |
'normal', |
| 75 |
'high' |
| 76 |
); |
| 77 |
} |
| 78 |
|
| 79 |
public function add_meta_box_grid() |
| 80 |
{ |
| 81 |
add_meta_box( |
| 82 |
'wpupg_meta_box_grid', |
| 83 |
__( 'Grid', 'wp-ultimate-post-grid' ), |
| 84 |
array( $this, 'meta_box_grid' ), |
| 85 |
WPUPG_POST_TYPE, |
| 86 |
'normal', |
| 87 |
'high' |
| 88 |
); |
| 89 |
} |
| 90 |
|
| 91 |
public function add_meta_box_pagination() |
| 92 |
{ |
| 93 |
add_meta_box( |
| 94 |
'wpupg_meta_box_pagination', |
| 95 |
__( 'Pagination', 'wp-ultimate-post-grid' ), |
| 96 |
array( $this, 'meta_box_pagination' ), |
| 97 |
WPUPG_POST_TYPE, |
| 98 |
'normal', |
| 99 |
'high' |
| 100 |
); |
| 101 |
|
| 102 |
add_meta_box( |
| 103 |
'wpupg_meta_box_pagination_style', |
| 104 |
__( 'Pagination Style', 'wp-ultimate-post-grid' ), |
| 105 |
array( $this, 'meta_box_pagination_style' ), |
| 106 |
WPUPG_POST_TYPE, |
| 107 |
'normal', |
| 108 |
'high' |
| 109 |
); |
| 110 |
} |
| 111 |
|
| 112 |
public function meta_box_shortcode( $post ) |
| 113 |
{ |
| 114 |
$grid = new WPUPG_Grid( $post ); |
| 115 |
include( WPUltimatePostGrid::get()->coreDir . '/helpers/meta_boxes/meta_box_shortcode.php' ); |
| 116 |
} |
| 117 |
|
| 118 |
public function meta_box_premium_only( $post ) |
| 119 |
{ |
| 120 |
$grid = new WPUPG_Grid( $post ); |
| 121 |
include( WPUltimatePostGrid::get()->coreDir . '/helpers/meta_boxes/meta_box_premium_only.php' ); |
| 122 |
} |
| 123 |
|
| 124 |
public function meta_box_data_source( $post ) |
| 125 |
{ |
| 126 |
$grid = new WPUPG_Grid( $post ); |
| 127 |
include( WPUltimatePostGrid::get()->coreDir . '/helpers/meta_boxes/meta_box_data_source.php' ); |
| 128 |
} |
| 129 |
|
| 130 |
public function meta_box_limit_posts( $post ) |
| 131 |
{ |
| 132 |
$grid = new WPUPG_Grid( $post ); |
| 133 |
include( WPUltimatePostGrid::get()->coreDir . '/helpers/meta_boxes/meta_box_limit_posts.php' ); |
| 134 |
} |
| 135 |
|
| 136 |
public function meta_box_filter( $post ) |
| 137 |
{ |
| 138 |
$grid = new WPUPG_Grid( $post ); |
| 139 |
include( WPUltimatePostGrid::get()->coreDir . '/helpers/meta_boxes/meta_box_filter.php' ); |
| 140 |
} |
| 141 |
|
| 142 |
public function meta_box_isotope_filter( $post ) |
| 143 |
{ |
| 144 |
$grid = new WPUPG_Grid( $post ); |
| 145 |
include( WPUltimatePostGrid::get()->coreDir . '/helpers/meta_boxes/meta_box_isotope_filter.php' ); |
| 146 |
} |
| 147 |
|
| 148 |
public function meta_box_grid( $post ) |
| 149 |
{ |
| 150 |
$grid = new WPUPG_Grid( $post ); |
| 151 |
include( WPUltimatePostGrid::get()->coreDir . '/helpers/meta_boxes/meta_box_grid.php' ); |
| 152 |
} |
| 153 |
|
| 154 |
public function meta_box_pagination( $post ) |
| 155 |
{ |
| 156 |
$grid = new WPUPG_Grid( $post ); |
| 157 |
include( WPUltimatePostGrid::get()->coreDir . '/helpers/meta_boxes/meta_box_pagination.php' ); |
| 158 |
} |
| 159 |
|
| 160 |
public function meta_box_pagination_style( $post ) |
| 161 |
{ |
| 162 |
$grid = new WPUPG_Grid( $post ); |
| 163 |
include( WPUltimatePostGrid::get()->coreDir . '/helpers/meta_boxes/meta_box_pagination_style.php' ); |
| 164 |
} |
| 165 |
} |