Check if current page is using blocks (Gutenberg) or is legacy

Question

Is there a way to know if a page is using Gutenberg or not?

The use case is migrating an old post to Gutenberg and letting crafted pages just render themselves with blocks but add some wrapping around old pages which probably won’t be migrated since they’re just text (Privacy policy and those). They need to coexist at least for a while.

A block editor page can usually be just rendered with

<?php

get_header();

while (have_posts()) :
  the_post();
  the_content();
endwhile;

get_footer();

While I have that handled for the homepage using a p front-page.php template, I’d like to have a generic template that can handle both types so I don’t have to go slug by slug.

0
Antonio Laguna 8 months 2020-12-07T08:10:26-05:00 0 Answers 9 views 0

Leave an answer

Browse
Browse