-
Notifications
You must be signed in to change notification settings - Fork 0
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
Create a block to display the Seen before post meta data #23
Comments
I'll start with a new plugin called sb-field-block. |
OK. I created a plugin called sb-field-block and implemented a block called
|
The changes necessary to allow the
The meta data that has been registered is available in the REST API output.
Property definitions For the dynamic block to be displayed on the front-end the block needs to be registered with a callback function to render it.
Note: The block's settings are loaded from |
While documenting the background of the requirements for a generic field block in bobbingwide/sb-field-block#1 I realised that one way of allowing the block to be used multiple times in a post would be to have a toggle to control whether or not the post meta value is auto-incremented. |
The |
The Seen before block doesn't work in the Site editor. It produces "This block has encountered an error and cannot be previewed". The console log shows
|
I tried changing the edit function to not reference I was using both the code to define the attribute in Removing the attribute definition resolved the issue. |
On the bigram's home page, archive pages and each singular page that displays a bigram there's a post meta field
that displays how many times the bigram has been seen.
The display is pretty basic
where n,nnn is the internationalised formatted number.
The Genesis-SB theme displays this automatically using the PHP function
genesis_sb_seen_before()
For the SB theme I want to display this metadata using a block.
Requirements
Block to display the post meta value field name
_seen_before
See also bobbingwide/sb#10
Proposed solution
register_post_meta
to make the field accessible using the REST APIThe block name will be
bigram/seen-before
Since the value is supposed to be auto-incremented the post meta data doesn't need to be updateable.
But we may as well write the code to allow it to be updated as this will be necessary for other fields.
The text was updated successfully, but these errors were encountered: