0

我正在使用 Trellis 根堆栈建立一个新的 WordPress 项目。我尝试使用碳字段作为必须使用的插件进行安装。但我不能让它工作。容器出现,但无法显示某些字段。

我从碳领域文档的许多版本中尝试了许多可能性。但是我目前正在使用 v3 和网格堆栈似乎是一个大问题。

add_action('after_setup_theme', 'crb_load');
function crb_load()
{
    \Carbon_Fields\Carbon_Fields::boot();
}

add_action('carbon_fields_register_fields', 'crb_attach_theme_options');
function crb_attach_theme_options()
{
    Container::make('theme_options', __('Theme Options', 'crb'))->add_fields(
        array(Field::make('rich_text', 'crb_footer_copyright', 'Copyright'))
    );

    Container::make('post_meta', 'Homepage slider')
        ->show_on_template('templates/custom-template.php')
        ->add_fields(array(
            Field::make('map', 'crb_location')->set_position(
                37.423156,
                -122.084917,
                14
            ),
            Field::make('sidebar', 'crb_custom_sidebar'),
            Field::make('image', 'crb_photo')
        ));

    Block::make(__('My Shiny Gutenberg Block'))
        ->add_fields(array(
            Field::make('text', 'heading', __('Block Heading')),
            Field::make('image', 'image', __('Block Image')),
            Field::make('rich_text', 'content', __('Block Content'))
        ))
        ->set_render_callback(function ($block) {
            ?>

        <div class="block">
            <div class="block__heading">
                <h1><?php echo esc_html($block['heading']); ?></h1>
            </div><!– /.block__heading –&gt;
            <div class="block__image">
                <?php echo wp_get_attachment_image($block['image'], 'full'); ?>
            </div><!– /.block__image –&gt;

            <div class="block__content">
                <?php echo apply_filters('the_content', $block['content']); ?>
            </div><!– /.block__content –&gt;
        </div><!– /.block –&gt;

        <?php
        });
}
GET http://localhost:3000/wp/core/Libraries/Sidebar_Manager/assets/js/app.js?ver=3.1.3 404 (Not Found)
admin.php?page=crb_carbon_fields_container_theme_options.php:1879 GET http://localhost:3000/wp/build/classic/vendor.js?ver=3.1.3 net::ERR_ABORTED 404 (Not Found)
admin.php?page=crb_carbon_fields_container_theme_options.php:1880 GET http://localhost:3000/wp/build/classic/core.js?ver=3.1.3 net::ERR_ABORTED 404 (Not Found)
admin.php?page=crb_carbon_fields_container_theme_options.php:1881 GET http://localhost:3000/wp/build/classic/metaboxes.js?ver=3.1.3 net::ERR_ABORTED 404 (Not Found)
admin.php?page=crb_carbon_fields_container_theme_options.php:1879 GET http://localhost:3000/wp/build/classic/vendor.js?ver=3.1.3 net::ERR_ABORTED 404 (Not Found)
admin.php?page=crb_carbon_fields_container_theme_options.php:1880 GET http://localhost:3000/wp/build/classic/core.js?ver=3.1.3 net::ERR_ABORTED 404 (Not Found)
admin.php?page=crb_carbon_fields_container_theme_options.php:1881 GET http://localhost:3000/wp/build/classic/metaboxes.js?ver=3.1.3 net::ERR_ABORTED 404 (Not Found)
admin.php?page=crb_carbon_fields_container_theme_options.php:1994 Uncaught TypeError: Cannot read property 'initialize' of undefined
    at admin.php?page=crb_carbon_fields_container_theme_options.php:1994

有错误,我不知道如何清除所有这些调用的路径。

提前致谢 !

4

0 回答 0