Opened 7 weeks ago
Closed 8 days ago
#62243 closed defect (bug) (fixed)
Twenty Twenty: Latest post block there is no space between post-author/post-date and post content on the front-end.
Reported by: | viralsampat | Owned by: | karmatosed |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | minor | Version: | |
Component: | Bundled Theme | Keywords: | has-patch commit |
Focuses: | css | Cc: |
Description
Hello Team,
I have checked "Latest Post" block and found that when we add post-author/post-date there is no space between post-author/post-date and post content on the front-end, But on the admin editor side it looks good, There is some space between post-author/post-date and post content.
For better understanding, Here I have attached its screenshots:
Thanks,
Attachments (7)
Change History (14)
@
7 weeks ago
I have checked above mentioned issue and I have resolved it and added patch. Also, I have attached screenshot after resolved this issue.
#1
@
4 weeks ago
Hey @viralsampat,
Thanks for raising this issue! I couldn’t reproduce it on my end.
Here’s what I tested:
- Twenty Twenty theme on WordPress versions 6.7 to 6.4
- Twenty Twenty theme on Local by Flywheel on WordPress 6.6
After checking the style.css file from core/latest-posts, I found this rule:
.wp-block-latest-posts__post-excerpt { margin-top: 0.5em; margin-bottom: 1em; }
This CSS rule adds a top margin, which appears to be adding the gap.
You can view the relevant code here:
Could you please provide more details or any additional steps needed to replicate the issue?
Thanks!
#2
@
2 weeks ago
- Keywords reporter-feedback added; dev-feedback removed
- Summary changed from Twenty Twenty Theme: Latest post block there is no space between post-author/post-date and post content on the front-end. to Twenty Twenty: Latest post block there is no space between post-author/post-date and post content on the front-end.
@viralsampat are you still able to reproduce this issue?
@
2 weeks ago
adds 1em
top margin to a paragraph if it is the first element in the post content, within a Latest Posts block
#3
@
2 weeks ago
- Keywords has-patch added; needs-patch reporter-feedback removed
- Severity changed from normal to minor
The lack of space can occur when
- the Latest Posts block is set to show "Full post" and
- the first element/block in the post is a paragraph.
The excerpt option has a small margin from block styles (GB15722), but #47340 added a margin for the full post option in Twenty Nineteen and PR 153 set the same top margin for both options in Twenty Twenty-One.
In Twenty Twenty, paragraphs have zero top margin. In contrast, a heading as the first block can have a top margin of 3.5rem
or more, and the Image block has a 4rem
margin.
Patch notes:
- If the selector targets the paragraph element, it needs to apply only when that paragraph is at the beginning of the post. 62243.1.patch uses
.wp-block-latest-posts__post-full-content > p:first-child
. - Targeting the
.wp-block-latest-posts__post-full-content
div is another option. It would give a minimum margin above the post content, and I did not notice that rule increasing the space when the first inner block has its own margin. - If this were the newest theme, I would suggest giving the
:first-child
a consistent margin regardless of the element. However, five years later, I would prefer to keep any changes minimal. - The
.entry-content
class (62243.patch) would apply styles only within page/post content, and the Latest Posts block is intended for the Widgets area(s).
#4
@
11 days ago
- Keywords needs-testing removed
Test Report
Description
This report validates that the suggested patch works as expected.
Patch tested: 62243.1.patch
Environment
- WordPress: 6.8-alpha-59274-src
- PHP: 8.2.25
- Server: nginx/1.27.2
- Database: mysqli (Server: 8.0.40 / Client: mysqlnd 8.2.25)
- Browser: Chrome 131.0.0.0
- OS: macOS
- Theme: Twenty Twenty 2.8
Actual Results
✅ Issue resolved with the patch.
Supplemental Artifacts
Back-end: https://postimg.cc/xJn7Vv85
Front-end: https://postimg.cc/QFn13hMy
Back-end