Open douglas-johnson opened 1 year ago
Notes regarding full site editing for author archives:
Here is an audit of the core blocks when used in an author archive template:
get_the_archive_title()
which CAP filters here: https://github.com/Automattic/Co-Authors-Plus/blob/3.5.10/co-authors-plus.php#L137author
query_var
which might make it look this this is working:Stopping by with an updated as I continue working on this branch: https://github.com/Automattic/Co-Authors-Plus/compare/master...thoughtis:Co-Authors-Plus:block-exploration
I pushed things like:
Notes:
useLayout
hook that is being utilized in the Gutenberg / Core blocks since block spacing between elements in the "block" layout mentioned above would be advantageous.Since my last comment here I worked on:
I plan to work on avatars next.
Here's a video where I add coauthor bylines to a query loop on the front page through full site editing. I tried to click around to all the current features. I plan to work on layout settings next. I'm happy for feedback if anyone wants to try out the branch here.
https://github.com/Automattic/Co-Authors-Plus/assets/226381/ddeec941-355e-47b4-a701-eea03ccbb91f
That's looking fantastic!
@douglas-johnson Excellent demo! You've put a lot of work into customization in-editor and it looks amazing.
Since my last update I worked on layout settings as planned and tried to figure out how to provide the correct context to blocks used on the author archive.
I made a new branch when I started exploring the layout changes. It is available here: https://github.com/Automattic/Co-Authors-Plus/compare/master...thoughtis:Co-Authors-Plus:issue%23940/coauthor-blocks
I this video I use FSE to add Co-Authors to the Post Meta template part within the Single template. It uses the block layout which supports vertical spacing between coauthors.
https://github.com/Automattic/Co-Authors-Plus/assets/226381/a336e530-67ce-461f-b337-264545e871a0
In this video I add CAP blocks to the author archive template without wrapping them in the Co-Authors block.
To support this I added a filter on render_block_context
that provides the queried author based on the author_name
query var. This works in the condition where:
true === is_author()
)You can see that code here: https://github.com/thoughtis/Co-Authors-Plus/blob/db8529990dd2d0dcc316ab9bd96f63e97af225fc/blocks/coauthor-display-name/class-cap-block-coauthor-display-name.php#L84
https://github.com/Automattic/Co-Authors-Plus/assets/226381/a339bf50-c6c8-4972-b1a9-5d613fc303c0
Looking amazing! Intuitive, flexible, and just what's been missing all this time! Thank you for doing this.
Hi @GaryJones and @alecgeatches - I'm stopping by with one more demo. This time its for guest author feature images.
With this working, I feel we have the intended features. There is still work I would like to do in documentation and developer experience as well as testing and fine tuning. I am out on vacation starting tomorrow and will be back on September 5th.
https://github.com/Automattic/Co-Authors-Plus/assets/226381/9b567509-a3f7-4be3-812f-0581752138d7
https://github.com/Automattic/Co-Authors-Plus/assets/226381/adfbf6d3-4016-479a-80df-7a7d405857b0
rest_register_field
Amazing š¤©
What's the difference between the Co-Author Avatar and Co-Author Feature Image blocks?
What's the difference between the Co-Author Avatar and Co-Author Feature Image blocks?
Avatar uses the avatar system. Its equivalent to calling get_avatar(). There are a limited number of sizes, they are always cropped square and will include Gravatars.
Feature Image is for higher resolution images and doesn't have the Gravatar fallback. Since it starts with an attachment id, we can provide the size, cropping and border settings from the core Feature Image block. Its similar to calling wp_get_attachment_image().
How does the Co-Author Feature Image block differ from the core Feature Image block?
How does the Co-Author Feature Image block differ from the core Feature Image block?
The core block needs to be in a post context. The co-author block uses the author context I've set up. It supports resizing, aspect ratios, and border settings, but I didn't incorporate the overlay capability of the core block.
When will these changes see the light of day? So missing working with the plugin in the block editor :( Very much waiting for the new version!
When will these changes see the light of day? So missing working with the plugin in the block editor :( Very much waiting for the new version!
Hi @IvanPigarev I'm happy to know someone else wants to use this. I can't promise when it will be released, but I will be back at work September 5th and working on the pull request as soon as possible after that. You are welcome to test with the current branch and provide any feedback.
https://github.com/thoughtis/Co-Authors-Plus/tree/issue%23940/coauthor-blocks
@douglas-johnson The blocks are looking great, and I'd very much like to use them on a project that's launching in a couple months. To that end, please let me know if there's anything specific you'd like to get feedback or thorough testing on, or if there's any other way I can help out!
Hi @philcable thanks so much for the offer. I would be happy for your feedback on whatever use case is relevant to your project. If you could use the current branch to implement some portion of your project and let me know how it goes that would be great.
I am espescially interested to have someone test the ability to make a custom block and extend the REST API data to support whatever unique data is in their custom block. But, I understand that would be an unnecessary time commitment if it's not relevant to your project.
@philcable I want to send an update in case you are actually trying to add a custom block that uses author data. I just updated the pull request to address some feedback and there are three changes that would need to be reflected in a custom block.
co-authors-plus/author
co-authors-plus/blocks
useContext
property from the block metadata.Thank you for keeping me posted, @douglas-johnson! I haven't had a chance to test things out just yet, but I'll let you know when I do.
Any more work happening on this? This is the exact functionality I need, but it seems on the wp.org site that this plugin is more or less abandonded for the last 8 months? I can't contribute with code, but if I can do anything else to help, please let me know.
@audunmb Great question! @douglas-johnson's work in https://github.com/Automattic/Co-Authors-Plus/pull/997 is essentially done, and it's my fault that this hasn't been merged in yet. We'll get this tested and merged this week.
@douglas-johnson The next release with your changes is very nearly ready to go in https://github.com/Automattic/Co-Authors-Plus/pull/1032! I'm going to wait until next week to check with @GaryJones and ensure the release is correct, but that should be straightforward. Thank you for all of your hard work and patience, we'll get this in shortly.
@alecgeatches That's great! I'm looking forward to getting it into production.
@alecgeatches I imagine we can close this issue. Before we say goodbye to it I wanted to gauge your interest in adding support for Social Icons. We needed this at work and I think I came up with something decent. It can be a separate issue though.
Removed AIM, YahooIM and Jabber. Added TikTok, Instagram and Twitter. Kept the website input. https://github.com/thoughtis/cata-co-authors-plus/blob/0.6.3/includes/meta-fields/class-meta-fields.php
Added functions to get URLs. They are forgiving so that either usernames / handles or URLs can be stored. https://github.com/thoughtis/cata-co-authors-plus/blob/0.6.3/includes/api/block-schema/social-links/global-functions.php
Used those functions to add social_links
to the coauthors/v1/
API responses.
https://github.com/thoughtis/cata-co-authors-plus/blob/0.6.3/includes/api/block-schema/social-links/class-social-links.php
Added a filter on register_block_type_args
so the core/social-link
block is opted in to co-author context.
Added a filter on render_block
so we can update the url
attribute of a core/social-link
block when the co-author context is available.
https://github.com/thoughtis/cata-co-authors-plus/blob/0.6.3/blocks/social-links/social-links.php
Now we can drop the Social Icons block into the Co-Authors block, select the services we want to display, and they will be filled in on render based on what data is available for that author. In my example video my Guest Author profile has several filled in, but the other author has none.
https://github.com/Automattic/Co-Authors-Plus/assets/226381/e80a8fed-710b-48a6-9e11-b91865ae3dc7
Social Icons block is a great idea! +1.
Continued from #932 cc @alecgeatches
Goal
Improve support for the block editor and full site editing by providing blocks to handle two use cases:
Features
Blocks
Block Editor
Full Site Editing
Layouts
Extensibility
coauthors_guest_author_fields
or should it go through the REST API framework?Features in consideration for future versions
Approach
API
Create two API endpoints intended to GET coauthor data.
GET CoAuthors by
:post-id
Use Case
Request
:post-id
in URLResponse
Authorization
GET CoAuthor by
:author-name
Use Case
Request
:author-name
in URL.cap-
prefix, same as author_name query_var available in author archive requests.Response
Authorization
CoAuthor Objects in API Responses
These objects should have the same shape as the objects returned by
get_coauthors()
, with some notable exceptions.Developer Experience
Use
wp-scripts
with the ability to run a single build command for all blocks and scripts in CAP.Compatibility considerations