themosis / framework

The Themosis framework core.
https://framework.themosis.com/
GNU General Public License v2.0
671 stars 121 forks source link

Fields not showing in Metabox #782

Closed calvinseng closed 4 years ago

calvinseng commented 4 years ago

Description

This is the first time I am using the framework. I have followed your documentation guide to create a Custom Post Type and a metabox and some fields within the metabox but none of the fields are showing. Following is the code I added under Hook after make.

    namespace App\Hooks;

    use Themosis\Hook\Hookable;
    use Themosis\Support\Facades\PostType;
    use Themosis\Support\Facades\Metabox;
    use Themosis\Support\Facades\Field;

    class Books extends Hookable
    {
        /**
         * Extend WordPress.
         */
        public function register()
        {
            $books = PostType::make('books', 'Books', 'Book')->set();

            // Add our custom statuses: rent, rented, sell, sold
            $books->status([
                'rent',
                'rented',
                'sell',
                'sold'
            ]);

            Metabox::make('properties', 'books')
            ->add(Field::text('author'))
            ->add(Field::text('isbn'))
            ->add(Field::integer('publication_year'))
            ->set();

          }

    }

https://prnt.sc/svp84s Attaching the metabox screenshot.

Steps to reproduce

  1. Create custom post type
  2. Create metabox
  3. Create fields

Expected behavior

Fields in metabox should be showing.

calvinseng commented 4 years ago

Found out that the default theme must be installed.