Roots Discourse

Render template using get_template_part

I am new to sage and trying to integrate Advanced custom Fields in sage. I put my code for creating blocks in custom folder which is under App> themes>custom-funtions.php and trying to get file under resource >views> blocks

function render_flexible_rows($template = 'blocks', $post_id = null) {
if (!$post_id) {
	$post_id = get_the_ID();

if (get_post_status($post_id) != 'publish') {
	return ;

if (have_rows($template, $post_id)) {

	$layout_index = 1;

	while (have_rows($template, $post_id)) {
		set_query_var('layout_index', $post_id . '--' . $layout_index);
		$layout = str_replace('_', '-', get_row_layout());
		get_template_part('views/blocks/block', $layout);

and $layout here is e.g (block-hero.blade.php or block-sidebar.blade.php)
But get_template_part is not working here?.

This topic was automatically closed after 42 days. New replies are no longer allowed.