Skip to content

Conversation

@colinswinney
Copy link

Description of the Change

  1. Sets up PostMeta classes in the 10up plugin for easy registration and customization per field.
  2. Adds a Movie Information panel to the sidebar to easily edit post meta.
  3. Creates an atomic read only block for Movie Runtime.
  4. Edits the single Movie template to utilize these new features.

How to test the Change

Create a new movie or select an existing one to edit their meta fields. Changes should be visible on the frontend.

Changelog Entry

Added - Movie meta field panel, Movie Runtime block.
Changed - Registration of meta fields, Movie Single template

Credits

Props @colinswinney

Checklist:

@colinswinney
Copy link
Author

Still to do:

  1. Continue moving meta field registration out of /10up-plugin/includes/classes/PostTypes/Movie.php (and Person.php) and into their own PostMeta classes.
  2. Create an editor panel for Person meta fields.
  3. Update single movie template to utilize bindings and/or create more atomic blocks when necessary.

@colinswinney colinswinney marked this pull request as ready for review February 24, 2025 07:49
@colinswinney
Copy link
Author

@fabiankaegy I think this is ready for a review. Basically I've done the following:

  1. Added a sidebar panel to handle editing post meta for a Movie.
  2. Added blocks and updated the template to conditionally render items based on the meta.
  3. Added bindings for the Archive link and Rating to demo block bindings.
  4. Updated the template with these new features.

The blocks that use peoples names such as "Director" are still hardcoded. This would be perfect for WP Content Connect to handle the relationships between post types but let me know if you have other thoughts on that.

Next steps would be working on the People single and figuring out what blocks/items we'd want users to complete as training tasks. What does a People single look like though?

Also, the trailer in the Movies template is still a hardcoded image. Should we make tied to a YouTube embed instead to add trailers?

Probably lots more to discuss but that's all I got for now, thanks!

@colinswinney colinswinney self-assigned this Feb 24, 2025
Copy link
Member

@fabiankaegy fabiankaegy left a comment

Choose a reason for hiding this comment

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

Very nice! I left some small suggestions inline but feel free to merge first and address in follow ups :)


const { tenup_movie_plot = '' } = meta || {};

let RenderedUI = (
Copy link
Member

Choose a reason for hiding this comment

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

Instead of reassigning the renderedUI multiple times I would simply use early returns for these cases

@@ -0,0 +1,211 @@
<?php
Copy link
Member

Choose a reason for hiding this comment

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

Can we update this to use the 10up-framework like in the scaffold today?

import { __ } from '@wordpress/i18n';
import { usePost } from '@10up/block-components';

export const BlockEdit = () => {
Copy link
Member

Choose a reason for hiding this comment

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

I would actually make this editable inline. When the block is then used in a template we can make it editable using the following filter:

addFilter('editor.postContentBlockTypes', 'namespace/example', (blockTypes) => {
	return [...blockTypes, 'tenup/example-block'];
});

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants