Skip to content

Commit

Permalink
Merge pull request #32 from haszari/fix/page-soundtrack-broken-on-pag…
Browse files Browse the repository at this point in the history
…e-type

fix soundtrack on pages
  • Loading branch information
haszari authored Dec 6, 2020
2 parents d5253e7 + c1a1a5c commit da41680
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions wp-content/plugins/audioblocks/audioblocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,21 @@ function pagesoundtrack_enqueue_block_editor_assets() {
// Register a meta field that our blocks depend on.
// It needs to be exposed to REST API so the value is available in Gutenberg environment.
function pagesoundtrack_blocks_init() {
register_post_meta( 'post', 'pagesoundtrack_playbackbpm', array(
'show_in_rest' => true,
'single' => true,
'type' => 'number',
) );
register_post_meta(
'', // Register for all post types - posts and pages.
'pagesoundtrack_playbackbpm',
array(
'show_in_rest' => true,
'single' => true,
'type' => 'number',
)
);
}
add_action( 'init', 'pagesoundtrack_blocks_init' );

// Render our page tempo value so we can use it in our front-end script.
function pagesoundtrack_blocks_content_filter( $content ) {
if ( ! is_single() ) {
if ( ! is_singular() ) {
// Only render tempo element for single-post pages, to disable soundtrack on
// archives etc.
return $content;
Expand Down

0 comments on commit da41680

Please sign in to comment.