I'm using timber and twig with wordpress trying to get the good old blog functionality. Problem is that i do not receive any posts when using the index.php (which is correct, right?)
When running this in index.php and assign a posts page in admin i get no posts. When running same code in a custom template file i get the posts. What on earth am i doing wrong here?
Index.php (no posts returned, wordpress predefined "blog" template, assigned as the posts page in settings)
<?php
/* File: index.php */
$context = Timber::context();
$args = array (
'post_type' => 'post',
'numberposts' => -1
);
$context['posts'] = Timber::get_posts($args);
$template = array('pages/news/index.twig');
Timber::render($template, $context);
News.php (posts returned, file assigned as a template for a page in wp-admin)
<?php
/* Template Name: News */
$context = Timber::context();
$args = array (
'post_type' => 'post',
'numberposts' => -1
);
$context['posts'] = Timber::get_posts($args);
$template = array('pages/news/index.twig');
Timber::render($template, $context);
index.twig (template)
{% if posts %}
{% for p in posts %}
{{ p|dump }}
{% endfor %}
{% endif %}