Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorder twig files #162

Merged
merged 11 commits into from
May 21, 2024
Merged

Reorder twig files #162

merged 11 commits into from
May 21, 2024

Conversation

Levdbas
Copy link
Member

@Levdbas Levdbas commented May 20, 2024

This is the first changes in a larger set of changes that I am going to propose.

Related:

Issue

Since the creation of the starter theme a lot has happened in PHP, WordPress and Timber. I want to make the starter-theme a more modern starting point for custom theme development.

Solution

This particular PR focusses on moving twig files to subdirectories for make a separation between the type of twig files.

Impact

A better, less confusing, start with templating in Timber.

Usage Changes

none

Considerations

-archive.twig is still a bit overkill, maybe we can simplify that as well by removing the parent() function

Copy link
Member

@gchtr gchtr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nice update! 👍

And yes, I agree with you that archive.twig in combination with {{ parent() }} maybe is a bit complicated for a starter theme.

We could also just copy over the relevant contents from index.twig to make it easier to start working with archive.twig.

author.php Outdated Show resolved Hide resolved
single.php Outdated Show resolved Hide resolved
@Levdbas
Copy link
Member Author

Levdbas commented May 21, 2024

@gchtr , modified the archive.twig and did some other minor tweaks, see comments.

author.php Outdated Show resolved Hide resolved
page.php Outdated
@@ -17,4 +17,4 @@
$context = Timber::context();
$post = $context['post'];

Timber::render(array('page-' . $post->post_name . '.twig', 'page.twig'), $context);
Timber::render(array('templates/page-' . $timber_post->post_name . '.twig', 'templates/page.twig'), $context);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$timber_post is not defined here, right?

single.php Outdated Show resolved Hide resolved
views/templates/archive.twig Outdated Show resolved Hide resolved
@Levdbas Levdbas merged commit 2ddc5b9 into 2.x May 21, 2024
9 checks passed
@Levdbas Levdbas deleted the reorder-twig-files branch May 21, 2024 15:19
@Levdbas Levdbas restored the reorder-twig-files branch May 21, 2024 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants