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

Add Archives block #7949

merged 11 commits into from Jul 16, 2018


5 participants
Copy link

talldan commented Jul 13, 2018

This PR is a continuation of #5495, moved to a local branch for easier collaboration. Props @miina for the bulk of the implementation.

Uses #5602

Continued archives block implementation from #1518 and #5495. Archive block implementation that uses similar output and filters as the archives widget. Has alignment toolbar within the block (left, center, right).


Block toolbar:
screen shot 2018-05-01 at 2 23 23 pm
Inspector toolbar:
screen shot 2018-05-01 at 2 17 54 pm
Dropdown view:
List view:

Fixes #1464.

@talldan talldan added the New Block label Jul 13, 2018

@talldan talldan self-assigned this Jul 13, 2018

@talldan talldan referenced this pull request Jul 13, 2018


Add Archives block #5495

@talldan talldan force-pushed the add/archives-block branch from 82008dd to 31bccd8 Jul 13, 2018

this.toggleDisplayAsDropdown = this.toggleDisplayAsDropdown.bind( this );

toggleShowPostCounts() {

This comment has been minimized.


This comment has been minimized.


talldan Jul 16, 2018

Author Contributor

I've changed this now to a functional component in ad5aa1d as per previous feedback on the old PR, so I don't think making them a single function would be workable now. On the plus side they're both one-liners now. :)

$block_content = sprintf(
'<div class="%1$s">%2$s</div>',

This comment has been minimized.


Soean Jul 13, 2018


div should be an 'ul'

This comment has been minimized.


talldan Jul 16, 2018

Author Contributor

Nice catch! It should be a ul when rendered as a list, and I've kept it as a div when rendered as a dropdown - 65025c1

talldan and others added some commits Jul 13, 2018

Changes from PR #5495 squashed into single commit
Co-authored-by: Pascal Birchler <>
Co-authored-by: Miina Sikk <>
Co-authored-by: Weston Ruter <>
Use `Disabled` element to prevent interaction with Archives Block edi…
…tor view

Use of `pointer-events` to disable interaction was problematic. It
didn't disabled the dropdown version of the block and it doesn't prevent
keyboard interaction.

The Disabled component handles these situations.

@talldan talldan force-pushed the add/archives-block branch from 31bccd8 to ad5aa1d Jul 16, 2018

@talldan talldan requested review from noisysocks and mcsf Jul 16, 2018


This comment has been minimized.

Copy link
Contributor Author

talldan commented Jul 16, 2018

Hey @noisysocks & @mcsf - I think I've addressed all the review feedback from #5495 now. Would be great if one of you could look over may changes to make sure they're ok. Thanks!


mcsf approved these changes Jul 16, 2018

Copy link

mcsf left a comment

Tests well, looks good. Thanks for working on this, @talldan.

export const settings = {
title: __( 'Archives' ),

description: __( 'Display a monthly archive of your site’s Posts.' ),

This comment has been minimized.


mcsf Jul 16, 2018


FWIW, filter widget_archives_dropdown_args can change the periodic interval, meaning "monthly" may become inaccurate. However, I could see filtering as a more advanced feature, and sticking with "monthly" offers the benefit of conveying the basic idea of the block more clearly than e.g. "Display a periodic archive […]". Because of this, I don't mind sticking with the current copy.

@mcsf mcsf changed the title Changes from PR #5495 squashed into single commit Add Archives block Jul 16, 2018

@mcsf mcsf merged commit 4f93f21 into master Jul 16, 2018

2 checks passed

codecov/project 49.08% (-0.41%) compared to 8db4360
continuous-integration/travis-ci/pr The Travis CI build passed

@mcsf mcsf deleted the add/archives-block branch Jul 16, 2018

@Soean Soean added this to the 3.3 milestone Jul 16, 2018

@afercia afercia added the Widgets label Jan 30, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment