Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Change post pattern on home.html, update template slugs #706

12 changes: 10 additions & 2 deletions patterns/page-home-business.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Title: Business home
* Slug: twentytwentyfour/home-business
* Slug: twentytwentyfour/page-home-business
* Categories: page
* Keywords: starter
* Block Types: core/post-content
Expand All @@ -14,5 +14,13 @@
<!-- wp:pattern {"slug":"twentytwentyfour/text-feature-grid-3-col"} /-->
<!-- wp:pattern {"slug":"twentytwentyfour/text-alternating-images"} /-->
<!-- wp:pattern {"slug":"twentytwentyfour/testimonial-centered"} /-->
<!-- wp:pattern {"slug":"twentytwentyfour/posts-grid-2-col"} /-->
<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"top":"var:preset|spacing|50","bottom":"var:preset|spacing|50","left":"var:preset|spacing|50","right":"var:preset|spacing|50"},"margin":{"top":"0","bottom":"0"}}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group alignfull" style="margin-top:0;margin-bottom:0;padding-top:var(--wp--preset--spacing--50);padding-right:var(--wp--preset--spacing--50);padding-bottom:var(--wp--preset--spacing--50);padding-left:var(--wp--preset--spacing--50)">
<!-- wp:heading {"align":"wide","style":{"typography":{"lineHeight":"1"},"spacing":{"margin":{"top":"0"}}},"fontSize":"x-large"} -->
<h2 class="wp-block-heading alignwide has-x-large-font-size" style="margin-top:0;line-height:1"><?php esc_html_e( 'Watch, Read, Listen', 'twentytwentyfour' ); ?></h2>
<!-- /wp:heading -->

<!-- wp:pattern {"slug":"twentytwentyfour/posts-3-col"} /-->
Copy link
Member

@felixarntz felixarntz Oct 27, 2023

Choose a reason for hiding this comment

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

If this is used as part of front-page.html while the WordPress site is configured to display a "static front page", it would look odd, since in that case there would only be the one page, with its excerpt shown in one of the three columns.

I'm not sure how we could fix this without modifying the WordPress template hierarchy. Honestly, I find this an odd configuration of WordPress core to choose front-page regardless of whether that page is configured to show the blog or a static page.

Potentially we can use the frontpage_template_hierarchy filter to customize this for TT4 to prefer a custom template, e.g. something like:

add_filter(
	'frontpage_template_hierarchy',
	function ( $templates ) {
		if ( is_home() ) {
			array_unshift( $templates, 'front-page-home.php' );
		}
		return $templates;
	}
);

If we did that in functions.php, we could have both a front-page.html and front-page-home.html template for the individual situations. front-page-home.html could use the content as is here, while front-page.html would instead replace those post columns with something similar to page.html, i.e. displaying the content of a single individual page.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would like to see a video of how that would work with the Site Editor. Why is it a PHP file? How do users edit it?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm getting more confused the more we talk about it. I assumed this was an issue so I renamed it, and now it seems to be a bigger issue that it's renamed? I'm fine reverting this change, but I have a hard time understanding what would be the best case, as it feels like whatever we do it's not. Adding code to fix something is not my preferred idea, because then you have to further explain how things work, and it will be harder for the average user to work with TT4. Since it's a legacy product, that's not what I want to achieve.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this shouldn't be fixed in the theme

Copy link
Member

Choose a reason for hiding this comment

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

we should probably limit this PR to only fixing the home.html template (without renaming it to front-page.html) and then continue exploring a solution for the renaming separately.

I'm good with this as well; to keep the scope/discussion focused.

Copy link
Member

Choose a reason for hiding this comment

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

I agree with you all that fixing it in the theme would be merely a workaround for it being fixed in core, so I'm totally supportive of not doing that. We just won't be able to use this template as front-page.html until that part is fixed in core. I'm happy to open a Trac ticket for that part, so that at least in the future it could be reconsidered.

@luminuu

I'm getting more confused the more we talk about it. I assumed this was an issue so I renamed it, and now it seems to be a bigger issue that it's renamed?

It's an issue that the blog template only shows the blog posts buried far down on the page, but that's a separate and minor issue compared to what I flagged in #705 / https://core.trac.wordpress.org/ticket/59759.

Given the above limitations of core, I think we should for now stick to only fixing the home.html template, without renaming it. In other words, that won't address #404, but it will address #705 / https://core.trac.wordpress.org/ticket/59759.

</div>
<!-- /wp:group -->
<!-- wp:pattern {"slug":"twentytwentyfour/cta-subscribe-centered"} /-->
4 changes: 2 additions & 2 deletions patterns/template-home-business.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Title: Business home template
* Slug: twentytwentyfour/template-home
* Slug: twentytwentyfour/template-home-business
* Template Types: front-page, index, home
luminuu marked this conversation as resolved.
Show resolved Hide resolved
* Viewport width: 1400
* Inserter: no
Expand All @@ -12,7 +12,7 @@

<!-- wp:group {"tagName":"main","style":{"spacing":{"blockGap":"0","margin":{"top":"0"}}},"layout":{"type":"default"}} -->
<main class="wp-block-group" style="margin-top:0">
<!-- wp:pattern {"slug":"twentytwentyfour/home-business"} /-->
<!-- wp:pattern {"slug":"twentytwentyfour/page-home-business"} /-->
</main>
<!-- /wp:group -->

Expand Down
1 change: 1 addition & 0 deletions templates/front-page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- wp:pattern {"slug":"twentytwentyfour/template-home-business"} /-->
1 change: 0 additions & 1 deletion templates/home.html

This file was deleted.

Loading