
Last updated on October 24th, 2020
The Problem
WordPress’s Gutenberg editor has a native Code block. It looks like this:
function storefront_post_nav()
{
$args = [
'next_text' => '<span class="screen-reader-text">' . esc_html__('Next post:', 'storefront') . ' </span>%title',
'prev_text' => '<span class="screen-reader-text">' . esc_html__('Previous post:', 'storefront') . ' </span>%title',
'in_same_term' => true,
];
the_post_navigation($args);
}
I’m usually a big fan of native solutions, but this one is just not good enough. It doesn’t have, for example, semantic highlighting, which makes it harder to read. You can do better.
Continue reading How to Embed Code Snippets in a WordPress Post, and Make It AMP and SEO Friendly