最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

advanced custom fields - Gutenberg on an ACF options page

programmeradmin1浏览0评论

I would like to be able to add Gutenberg blocks to an ACF options page. I've been doing quite a bit of researching but have found nothing. For instance it would be nice to have a footer block and have it rendered/previewed on the "Footer" options page like it would be on the front end. Anyone know if this is possible?

I would like to be able to add Gutenberg blocks to an ACF options page. I've been doing quite a bit of researching but have found nothing. For instance it would be nice to have a footer block and have it rendered/previewed on the "Footer" options page like it would be on the front end. Anyone know if this is possible?

Share Improve this question asked Oct 10, 2019 at 15:02 bl0cklevelbl0cklevel 112 bronze badges 3
  • I can't see any way to add editor support to the ACF options page. If previewing the footer is important, then might I suggest you use the customizer to do this? It doesn't let you move blocks around, but it will render in the preview screen. – Faye Commented Oct 10, 2019 at 23:47
  • Any update on this? I'm using ACF option page to add fields to my custom post type archive page.. would be great to use Gutenberg here.. – user3405376 Commented Apr 8, 2020 at 12:10
  • @user3405376 I have been using the plugin "Reusable Blocks Extended" to achieve what I needed. It's a great solution. – bl0cklevel Commented Apr 9, 2020 at 13:31
Add a comment  | 

2 Answers 2

Reset to default 1

Create a page named as your archive, add blocks there. In archive-name.php please add:

<?php get_header();

$page_id   = get_post( 57 );
$page =  apply_filters( 'the_content', $page->post_content );

echo $page; ?>

<?php get_footer();

Replace '57' with your page ID. Now you can manage content of archive page directly from Pages.

Another workaround but maybe useful to others: I use a custom post type called "Globals" to store block templates used for global sections of the site such as footer.

It would be nice to be able to use an options page but I don't think its possible at the moment.

发布评论

评论列表(0)

  1. 暂无评论