wordpressthemesmeta-boxes

Code star framework add metabox to a specific page


I am using the code star framework full version. I have integrated the framework with the theme. How can I show the meta box option only for some specific pages ( like home page and about page )? Currently, the meta box options are showing all pages.


Solution

  • While creating metabox, you should pass "page_templates" value in array. For example, if you want to show metabox on homepage you should do:

        $homePage = 'home-page';
        CSF::createMetabox($homePage, array(
          'title'          => 'Homepage',
          'post_type'      => 'page',
          'page_templates' => 'index.php', //filename goes here
          'data_type'      => 'serialize',
        ));
    

    For more info: http://codestarframework.com/documentation/#/configurations?id=metabox-option-framework