timber / starter-theme

The "_s" for Timber: a dead-simple theme that you can build anything from
MIT License
817 stars 276 forks source link

get_header #29

Closed geibi closed 9 months ago

geibi commented 8 years ago

I'm a little confused about wp_head, get_header and wp_footer: I installed WooSidebars which needs a call to get_header(); So i placed get_header in page.php Now the header.php gets executed and does an ob_start.

Do i have to include get_footer now also because there's the ob_end? And if i do: What happens with the buffered content if i ain't got a view/page-plugin.twig template?

Would this be the right code and more important the right spot to include the get_header and get_footer calls? Do i have to call those functions on all the different types of pages like single.php, archive.php, page.php aso.? Or is there a better, centralized way?

` $context = Timber::get_context(); $post = new TimberPost(); $context['post'] = $post;

get_header();

if(!is_home() && !is_front_page()){ $context['has_sidebar'] = true; $context['dynamic_sidebar'] = Timber::get_widgets('primary-widget-area-id'); }

Timber::render( array( 'page-'.$post->post_name.'.twig', 'page.twig' ), $context );

get_footer(); `

geibi commented 8 years ago

... the problem seems to be if i call get_header AND get_footer, my header gets outputted twice. so i think i'm missing something, maybe removing another function when calling/using get_header and get_footer.