PHP code example of freshflesh / wp-render-template-part
1. Go to this page and download the library: Download freshflesh/wp-render-template-part library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
freshflesh / wp-render-template-part example snippets
$args = array(
'title' => 'Hello there.',
'content' => 'Lorem ipsum sid amet'
);
render_template_part( 'block', 'widget', $args );
Child template:
<div class="widget">
<h2> echo $title; // will output 'Hello there.'
echo $content; // will output 'Lorem ipsum sid amet'