- WordPress Challenges
- Posts
- WP Challenge #1: Block Development
WP Challenge #1: Block Development
Challenge your block development skills
Welcome to the WordPress Challenge #1.
In this challenge, we will focus on WordPress Block Development.
As with any challenge, you’ll be expected to try and do it all on yourself, but don’t worry.
Somewhere between 2nd or 3rd week of this month, I’ll send more tips & tricks for every challenge to get you closer.
See these challenges as exercises.
Hopefully, we’ll get subscribers who’ll send back their solutions and thus, if anyone is stuck, they’ll be able to learn from the provided solutions.
If none are sent, I’ll provide my own solutions to such in the upcoming month.
You’ll get points for solutions.
To check the status of points, you can check the public leaderboard: https://www.wpchallenges.com/leaderboard/
Junior Challenge: Create a Custom Gutenberg Block
Points: 1
Task:
Develop a custom Gutenberg block that displays a testimonial card with fields for a testimonial quote, author name, and author's job title.
Requirements:
Create a custom block using
@wordpress/create-block
,Implement a block that includes fields for testimonial quotes, author name, and job title,
Fields can be displayed either inside the block in the editor or on the side panel
Use Editor and Block Styles (editor if fields are displayed inside the block in the editor). Block Styles for the front.
Starting Tips:
Complete Block Tutorial (with a custom field): https://developer.wordpress.org/block-editor/getting-started/tutorial/
Block Handbook: https://developer.wordpress.org/block-editor/
Medior Challenge: Fetch & Display Dynamic Content
Points: 2
Task:
Create a block that fetches and displays posts from a specific category dynamically.
Requirements:
Have a dropdown that shows categories on the side panel,
Display fetched posts within the block (It can be only a linked title or more info if you want).
Starting Tips:
Use ServerSideRender to render the posts,
Use apiFetch to get categories for displaying in the side panel,
Use the default REST API endpoints to fetch categories or create your own.
Senior Challenge: Accordion
Points: 3
Task:
Create an accordion block where you can add multiple items that can be toggled.
Requirements:
Items need to be added through an “Add” button inside of the editor (not the panel)
Each item will have an accordion Title and accordion body
To keep it simple, each accordion body can be a simple text control
Accordions items should be collapsable on the front (optional on the editor)
For an additional 2 points, you can allow entering more content types for each item using InnerBlocks (for inspiration & example, check Block “Columns” & “Column” as those use the same InnerBlocks).
Starting Tips:
Check Gutenberg Accordion discussion in the repository
Check code from https://wordpress.org/plugins/lightweight-accordion/ for inspiration
How to send the code?
You can create one repo for this (& all future challenges) and have each folder contain a custom plugin for each challenge. Or create separate repos for each.
You can then reply to this through email with the link to the repo (it must be public so I can view it).
Happy Coding!
Reply