Как добавить новую пользовательскую страницу в Timber Wordpress

Версия Wordpress: 6.4.3 "timber/timber": "2.x-dev" Стартовая тема: upstatement/timber-starter-theme

Я понимаю, что вам нужен композитор для установки древесины, плагин больше не требуется. но как создать новую пользовательскую страницу в WordPress?

в атрибутах страницы я не вижу раскрывающегося списка tempalet для выбора шаблона Как добавить новую пользовательскую страницу в Timber Wordpress

Я что-то пропустил?

Я создал contact.php

<?php
/**
 * The main template file
 * This is the most generic template file in a WordPress theme
 * and one of the two required files for a theme (the other being style.css).
 * It is used to display a page when nothing more specific matches a query.
 * E.g., it puts together the home page when no home.php file exists
 *
 * Methods for TimberHelper can be found in the /lib sub-directory
 *
 * @package  WordPress
 * @subpackage  Timber
 * @since   Timber 0.1
 */

$context          = Timber::context();
$context['posts'] = Timber::get_posts();
$context['foo']   = 'bar';
$templates        = array( 'contact.twig' );
Timber::render( $templates, $context );

также контакт.ветка

{% extends "base.twig" %}

{% block content %}
    {% include "partial/altHero.twig" %}

    <h1>Contact</h1>

{% endblock %}

Я не уверен, что еще я упускаю? и я также не могу установить плагин древесины, Сообщение об ошибке, когда я пытаюсь установить плагин древесины **Плагин не удалось активировать, поскольку он вызвал фатальную ошибку. **

Ваша помощь очень ценна Ваше здоровье

Как убрать количество товаров в категории WooCommerce
Как убрать количество товаров в категории WooCommerce
По умолчанию WooCommerce показывает количество товаров рядом с категорией, как показано ниже.
0
0
57
1
Перейти к ответу Данный вопрос помечен как решенный

Ответы 1

Ответ принят как подходящий

введите сюда описание изображения

ок, наконец-то решил

вам нужно добавить комментарий на свою пользовательскую страницу PHP название и описание шаблона

без него он не будет отображаться

<?php
/**
 * Template Name: My Custom Page<<<<
 * Description: A Page Template with a darker design.<<<<
 * The main template file
 * This is the most generic template file in a WordPress theme
 * and one of the two required files for a theme (the other being style.css).
 * It is used to display a page when nothing more specific matches a query.
 * E.g., it puts together the home page when no home.php file exists
 *
 * Methods for TimberHelper can be found in the /lib sub-directory
 *
 * @package  WordPress
 * @subpackage  Timber
 * @since   Timber 0.1
 */

$context          = Timber::context();
$context['posts'] = Timber::get_posts();
$context['foo']   = 'bar';
$templates        = array( 'contact.twig' );
Timber::render( $templates, $context );

Другие вопросы по теме