/** * Display addons. * @since 1.0.0 * * @return array */ public function index() { $query = new WP_Query(['post_type' => 'addon', 'post_status' => 'publish']); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); $addon = new Addon(); $this->view->show('partials.archives.addon', ['addon' => $addon->from_post(get_post())]); } } wp_reset_query(); }
/** * Displays the addon metabox. * @since 1.0.0 * * @param object $post WP_Post. */ public function metabox_addon($post) { wp_nonce_field('metabox_addon', 'metabox_addon_nonce'); $this->view->show('admin.metaboxes.addon', ['addon' => Addon::find($post->ID)]); }