Custom Template for hardcoded block
Permalink 1 user found helpful
Hi there
I'm trying to hardcode an autonav block in to my theme, which is working well using the following code
Now my question: Is it possible to apply a custom template to this block?
I'm trying to hardcode an autonav block in to my theme, which is working well using the following code
$bt = BlockType::getByHandle('autonav'); $bt->controller->displayPages = 'second_level'; $bt->controller->orderBy = 'display_asc'; $bt->controller->displaySubPages = 'none'; $bt->controller->displaySubPageLevels = 'custom'; $bt->controller->displaySubPageLevelsNum = '3'; $bt->render('view');
Now my question: Is it possible to apply a custom template to this block?
$bt->render('view');
You replace with:
$bt->render('templates/custom-nav');
And then place custom-nav.php into the blocks/autonav/templates folder.