private ?PostsModel $model = null; public function __construct() { parent::__construct(); $this->model = new PostsModel(Timber::get_post()->wp_object()); } public function indexAction() { $this->render("postList.twig", [<?phpuse Components\Posts\PostsController;(new PostsController())->indexAction();return; * * @param string $template The path of the template about to be included. */ do_action( 'wp_before_include_template', $template ); include $template; } elseif ( current_user_can( 'switch_themes' ) ) { $theme = wp_get_theme(); if ( $theme->errors() ) { wp_die( $theme->errors() ); } // Set up the WordPress query. wp(); // Load the theme template. require_once ABSPATH . WPINC . '/template-loader.php';} * @var bool */define( 'WP_USE_THEMES', true );/** Loads the WordPress Environment and Template */require __DIR__ . '/wp-blog-header.php';|
Error
|
|---|
Error:
Call to a member function wp_object() on null
at /data/htdocs/colours-dev/www/wp-content/themes/coloursofostrava/panda/Components/Posts/PostsController.php:21
at Components\Posts\PostsController->__construct()
(/data/htdocs/colours-dev/www/wp-content/themes/coloursofostrava/index.php:5)
at include('/data/htdocs/colours-dev/www/wp-content/themes/coloursofostrava/index.php')
(/data/htdocs/colours-dev/www/wp-includes/template-loader.php:132)
at require_once('/data/htdocs/colours-dev/www/wp-includes/template-loader.php')
(/data/htdocs/colours-dev/www/wp-blog-header.php:19)
at require('/data/htdocs/colours-dev/www/wp-blog-header.php')
(/data/htdocs/colours-dev/www/index.php:17)
|