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

Home writer pattern #332

Merged
merged 3 commits into from
Sep 18, 2023
Merged

Home writer pattern #332

merged 3 commits into from
Sep 18, 2023

Conversation

MaggieCabrera
Copy link
Collaborator

@MaggieCabrera MaggieCabrera commented Sep 12, 2023

Description

Same treatment as home portfolio but for home writer template pattern

Screenshots

Screenshot 2023-09-12 at 11 58 10

Looks like the header and footer are not loading. I'm using the markup that should work after #316 and #318 are merged

?>

<!-- wp:group {"style":{"position":{"type":"sticky","top":"0px"}},"layout":{"type":"default"},"tagName":"header"} --><header class="wp-block-group">
<!-- wp:template-part {"slug":"header"} /-->
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<!-- wp:template-part {"slug":"header"} /-->
<!-- wp:template-part {"theme":"twentytwentyfour","slug":"header"} /-->

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

will this break if the theme is in a subdirectory?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure. Define subdirectory. (there are different ways to setup both wp and the theme folder, which one?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Will it work if my theme is inside wp-content/themes/mythemes/twentytwentyfour?

Copy link
Contributor

Choose a reason for hiding this comment

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

I did a quick test on macOS and it did not work.

Copy link
Contributor

Choose a reason for hiding this comment

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

Fresh install of 6.4 nightly through the beta tester plugin.
Gutenberg trunk.
This PR.

Go to Appearance, Themes. Activate Twenty Twenty-Four.
Select "View site": confirm that everything is loading on the front.
Select "Edit Site" from the toolbar, or, go back to the admin and select Appearance: Editor.
The blog home page will be selected.
Select Edit.
Delete ALL blocks.
Save. Refresh.
Now, the pattern selection modal should show.
It should offer you 3 "patterns" to choose from.
Notice that pattern one and two has the footer and header. The third option shows the
"Template part has been deleted or is unavailable" message in the preview.

Select this option. This inserts the blocks. Confirm that the "Template part has been deleted or is unavailable" still shows in the editor.

In the browser tools console, I am seeing the following:

/index.php?rest_route=%2Fwp%2Fv2%2Ftemplate-parts%2Fundefined%2F%2Fheader&context=edit&_locale=user:1     Failed to load resource: the server responded with a status of 404 (Not Found)
/index.php?rest_route=%2Fwp%2Fv2%2Ftemplate-parts%2Fundefined%2F%2Ffooter-writer&context=edit&_locale=user:1     Failed to load resource: the server responded with a status of 404 (Not Found)

index.js:102     GET http://64.local/index.php?rest_route=%2Fwp%2Fv2%2Ftemplate-parts%2Fundefined%2F%2Fheader&context=edit&_locale=user 404 (Not Found)
defaultFetchHandler @ index.js:102
fetchAllMiddleware @ fetch-all-middleware.js:84
(anonymous) @ index.js:163
httpV1Middleware @ http-v1.js:40
(anonymous) @ index.js:163
namespaceAndEndpointMiddleware @ namespace-endpoint.js:24
(anonymous) @ index.js:163
userLocaleMiddleware @ user-locale.js:24
(anonymous) @ index.js:163
(anonymous) @ root-url.js:37
namespaceAndEndpointMiddleware @ namespace-endpoint.js:24
(anonymous) @ root-url.js:11
(anonymous) @ index.js:163
middleware @ nonce.js:23
(anonymous) @ index.js:163
mediaUploadMiddleware @ media-upload.js:34
(anonymous) @ index.js:163
(anonymous) @ preloading.js:59
(anonymous) @ index.js:163
apiFetch @ index.js:168
(anonymous) @ resolvers.js:164
await in (anonymous) (async)
(anonymous) @ thunk-middleware.js:4
(anonymous) @ index.js:24
(anonymous) @ promise-middleware.js:20
(anonymous) @ resolvers-cache-middleware.js:51
(anonymous) @ index.js:591
setTimeout (async)
fulfillSelector @ index.js:583
selectorResolver @ index.js:605
isActive @ variations.js:38
(anonymous) @ selectors.js:258
getActiveBlockVariation @ selectors.js:241
boundSelector @ index.js:237
(anonymous) @ index.js:129
(anonymous) @ index.js:134
__unstableMarkListeningStores @ registry.js:123
(anonymous) @ registry.js:204
updateValue @ index.js:133
(anonymous) @ index.js:180
useMappingSelect @ index.js:198
useSelect @ index.js:287
useBlockProps @ index.js:106
TemplatePartEdit @ index.js:88
of @ react-dom.min.js?ver=18:109
Rk @ react-dom.min.js?ver=18:250
Si @ react-dom.min.js?ver=18:195
Pk @ react-dom.min.js?ver=18:195
Nd @ react-dom.min.js?ver=18:194
Oi @ react-dom.min.js?ver=18:185
S @ react.min.js?ver=18:17
U @ react.min.js?ver=18:21
index.js:102     GET http://64.local/index.php?rest_route=%2Fwp%2Fv2%2Ftemplate-parts%2Fundefined%2F%2Ffooter-writer&context=edit&_locale=user 404 (Not Found)
defaultFetchHandler @ index.js:102
fetchAllMiddleware @ fetch-all-middleware.js:84
(anonymous) @ index.js:163
httpV1Middleware @ http-v1.js:40
(anonymous) @ index.js:163
namespaceAndEndpointMiddleware @ namespace-endpoint.js:24
(anonymous) @ index.js:163
userLocaleMiddleware @ user-locale.js:24
(anonymous) @ index.js:163
(anonymous) @ root-url.js:37
namespaceAndEndpointMiddleware @ namespace-endpoint.js:24
(anonymous) @ root-url.js:11
(anonymous) @ index.js:163
middleware @ nonce.js:23
(anonymous) @ index.js:163
mediaUploadMiddleware @ media-upload.js:34
(anonymous) @ index.js:163
(anonymous) @ preloading.js:59
(anonymous) @ index.js:163
apiFetch @ index.js:168
(anonymous) @ resolvers.js:164
await in (anonymous) (async)
(anonymous) @ thunk-middleware.js:4
(anonymous) @ index.js:24
(anonymous) @ promise-middleware.js:20
(anonymous) @ resolvers-cache-middleware.js:51
(anonymous) @ index.js:591
setTimeout (async)
fulfillSelector @ index.js:583
selectorResolver @ index.js:605
(anonymous) @ template-part-edit.js:26
(anonymous) @ index.js:134
__unstableMarkListeningStores @ registry.js:123
(anonymous) @ registry.js:204
updateValue @ index.js:133
(anonymous) @ index.js:180
useMappingSelect @ index.js:198
useSelect @ index.js:287
EditTemplatePartMenuItem @ template-part-edit.js:24
of @ react-dom.min.js?ver=18:109
Rk @ react-dom.min.js?ver=18:250
Si @ react-dom.min.js?ver=18:195
Pk @ react-dom.min.js?ver=18:195
Nd @ react-dom.min.js?ver=18:194
Oi @ react-dom.min.js?ver=18:185
S @ react.min.js?ver=18:17
U @ react.min.js?ver=18:21

I did not notice this earlier, or I would have included it :)

If I add this to my browser: http://64.local/index.php?rest_route=%2Fwp%2Fv2%2Ftemplate-parts%2Fundefined%2F%2Fheader&context=edit&_locale=user

I see:
{"code":"rest_cannot_manage_templates","message":"Sorry, you are not allowed to access the templates on this site.","data":{"status":401}}

Save.
Select the "View Site" option. Confirm that the header and footer are not loading on the front, either.

Copy link
Contributor

Choose a reason for hiding this comment

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

`

wp-core

version: 6.4-alpha-56569
site_language: en_US
user_language: en_US
timezone: +00:00
permalink: undefined
https_status: false
multisite: false
user_registration: 0
blog_public: 1
default_comment_status: open
environment_type: local
user_count: 1
dotorg_communication: true

wp-paths-sizes

wordpress_path: /Users/carolina/LocalSites/64/app/public
wordpress_size: 52.12 MB (54647391 bytes)
uploads_path: /Users/carolina/LocalSites/64/app/public/wp-content/uploads
uploads_size: 1.47 MB (1545180 bytes)
themes_path: /Users/carolina/LocalSites/64/app/public/wp-content/themes
themes_size: 88.65 MB (92958483 bytes)
plugins_path: /Users/carolina/LocalSites/64/app/public/wp-content/plugins
plugins_size: 1.92 GB (2064712706 bytes)
database_size: 2.13 MB (2228224 bytes)
total_size: 2.06 GB (2216091984 bytes)

wp-active-theme

name: Twenty Twenty-Four (twentytwentyfour)
version: 1.0
author: the WordPress team
author_website: https://wordpress.org
parent_theme: none
theme_features: core-block-patterns, post-thumbnails, responsive-embeds, editor-styles, html5, automatic-feed-links, block-templates, widgets-block-editor, editor-style
theme_path: /Users/carolina/LocalSites/64/app/public/wp-content/themes/twentytwentyfour
auto_update: Disabled

wp-themes-inactive (13)

Twenty Eleven: version: 4.4, author: the WordPress team, Auto-updates disabled
Twenty Fifteen: version: 3.5, author: the WordPress team, Auto-updates disabled
Twenty Fourteen: version: 3.7, author: the WordPress team, Auto-updates disabled
Twenty Nineteen: version: 2.6, author: the WordPress team, Auto-updates disabled
Twenty Seventeen: version: 3.3, author: the WordPress team, Auto-updates disabled
Twenty Sixteen: version: 3.0, author: the WordPress team, Auto-updates disabled
Twenty Ten: version: 3.9, author: the WordPress team, Auto-updates disabled
Twenty Thirteen: version: 3.9, author: the WordPress team, Auto-updates disabled
Twenty Twelve: version: 4.0, author: the WordPress team, Auto-updates disabled
Twenty Twenty: version: 2.3, author: the WordPress team, Auto-updates disabled
Twenty Twenty-One: version: 1.9, author: the WordPress team, Auto-updates disabled
Twenty Twenty-Three: version: 1.2, author: the WordPress team, Auto-updates disabled
Twenty Twenty-Two: version: 1.5, author: the WordPress team, Auto-updates disabled

wp-plugins-active (2)

Gutenberg: version: 16.6.0, author: Gutenberg Team, Auto-updates disabled
WordPress Beta Tester: version: 3.5.4, author: WordPress Upgrade/Install Team, Auto-updates disabled

wp-plugins-inactive (1)

WordPress Reset: version: 1.4.2, author: Aristeides Stathopoulos, Matt Martz, Auto-updates disabled

wp-media

image_editor: WP_Image_Editor_Imagick
imagick_module_version: 1808
imagemagick_version: ImageMagick 7.1.0-46 Q16 x86_64 5ef3d4d66:20220816 https://imagemagick.org
imagick_version: 3.7.0
file_uploads: 1
post_max_size: 1000M
upload_max_filesize: 300M
max_effective_size: 300 MB
max_file_uploads: 20
imagick_limits:
imagick::RESOURCETYPE_AREA: 64 GB
imagick::RESOURCETYPE_DISK: 9.2233720368548E+18
imagick::RESOURCETYPE_FILE: 6144
imagick::RESOURCETYPE_MAP: 64 GB
imagick::RESOURCETYPE_MEMORY: 32 GB
imagick::RESOURCETYPE_THREAD: 1
imagick::RESOURCETYPE_TIME: 9.2233720368548E+18
imagemagick_file_formats: Unable to determine
gd_version: bundled (2.1.0 compatible)
gd_formats: GIF, JPEG, PNG, WebP, BMP
ghostscript_version: not available

wp-server

server_architecture: Darwin 22.6.0 x86_64
httpd_software: nginx/1.16.0
php_version: 8.1.9 64bit
php_sapi: fpm-fcgi
max_input_variables: 4000
time_limit: 1200
memory_limit: 256M
max_input_time: 600
upload_max_filesize: 300M
php_post_max_size: 1000M
curl_version: 7.84.0 (SecureTransport) OpenSSL/1.1.1q
suhosin: false
imagick_availability: true
pretty_permalinks: true
htaccess_extra_rules: false
current: 2023-09-14T07:01:34+00:00
utc-time: Thursday, 14-Sep-23 07:01:34 UTC
server-time: 2023-09-14T07:01:33+00:00

wp-database

extension: mysqli
server_version: 8.0.16
client_version: mysqlnd 8.1.9
max_allowed_packet: 16777216
max_connections: 151

wp-constants

WP_HOME: undefined
WP_SITEURL: undefined
WP_CONTENT_DIR: /Users/carolina/LocalSites/64/app/public/wp-content
WP_PLUGIN_DIR: /Users/carolina/LocalSites/64/app/public/wp-content/plugins
WP_MEMORY_LIMIT: 40M
WP_MAX_MEMORY_LIMIT: 256M
WP_DEBUG: false
WP_DEBUG_DISPLAY: true
WP_DEBUG_LOG: false
SCRIPT_DEBUG: false
WP_CACHE: false
CONCATENATE_SCRIPTS: undefined
COMPRESS_SCRIPTS: undefined
COMPRESS_CSS: undefined
WP_ENVIRONMENT_TYPE: local
WP_DEVELOPMENT_MODE: undefined
DB_CHARSET: utf8
DB_COLLATE: undefined

wp-filesystem

wordpress: writable
wp-content: writable
uploads: writable
plugins: writable
themes: writable

`

Copy link
Contributor

Choose a reason for hiding this comment

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

Seeing the same issue if I switch to PHP 8.0.22.

Copy link
Contributor

Choose a reason for hiding this comment

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

I switched from Local by wp-engine and tested using wordpress-develop with Docker, and it I am seeing the same issue.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added the theme attr so we can merge this PR, but Jason is still looking at what's causing this

@MaggieCabrera MaggieCabrera marked this pull request as draft September 15, 2023 11:35
@MaggieCabrera MaggieCabrera force-pushed the add-home-writer-pattern branch from db3e187 to 8a82ac6 Compare September 15, 2023 14:05
@MaggieCabrera MaggieCabrera marked this pull request as ready for review September 15, 2023 14:06
@MaggieCabrera
Copy link
Collaborator Author

I made this into a pattern. Let's get this in and correct the issue with the theme attr separately

@MaggieCabrera MaggieCabrera mentioned this pull request Sep 15, 2023
@carolinan carolinan merged commit 4c969db into trunk Sep 18, 2023
2 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

4 participants