Skip to content

Instantly share code, notes, and snippets.

@rogden
Created August 28, 2018 17:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rogden/d3d17c408e4ceb7e56e9e3a9d977f79f to your computer and use it in GitHub Desktop.
Save rogden/d3d17c408e4ceb7e56e9e3a9d977f79f to your computer and use it in GitHub Desktop.
Example of rendering template from Fractal in WordPress Theme
<?php
// https://fractal.build/
the_post();
get_header();
// render is a global function exposed to render templates from Fractal. @article is the template handle in Fractal. The
// Handlebars rendering engine has been setup to load templates from a pattern-library directory that contains the Fractal install.
render( '@article', [
'title' => get_the_title(),
'content' => get_the_content(),
] );
get_footer();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment