Using plain PHP templates¶
Let’s take the unaltered default theme as an example. In
default template which calls a
render_partial for the
doctype html html head= render_partial("layouts/head") body .page-wrapper header.site-header= render_partial("layouts/header") section.site-content= wl_yield() footer.site-footer= render_partial("layouts/footer") // jQuery and application.js is loaded by default with wp_footer() function. See config/initializers/default_hooks.php for details - wp_footer()
h1!= link_to(get_bloginfo('name'), get_bloginfo('url')) h2= get_bloginfo('description')
Let’s suppose we need to change
_header in a PHP template because we don’t
like PUG or we need to write complex code there.
If you have to write complex code in a view you are on the wrong path :)
Update its content, e.g.:
<h1> <?php echo link_to(get_bloginfo('name'), get_bloginfo('url')); ?> </h1> <h2> <?php echo htmlentities(get_bloginfo('description')) ?> </h2>
render_partial("layouts/header") doesn’t find
will automatically search for
_header.html.php and will use it as is,
without passing through any compilation process.
As you can see, Wordless does not force you that much. Moreover, you will continue to have its goodies/helpers to break down views in little partials, simplifying code readability and organization.