Skip to content

Using Timber in a DIVI extension #2590

Closed Answered by gchtr
robibi78 asked this question in Q&A
Discussion options

You must be logged in to vote

@robibi78 Try using Timber::compile() instead of Timber::render(). The Timber::render() method echoes the output. Because you use a return, I assume you don’t want your output to be echoed in your render function, but only returned as a string:

public function render( $unprocessed_props, $content, $render_slug ) {
    $context                 = Timber::get_context();
    $context['publications'] = $this->get_hal( 'FRANCE-GRILLES' )->docs;

    return Timber::compile( 'page.twig', $context );
}

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by robibi78
Comment options

You must be logged in to vote
1 reply
@gchtr
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants