Adding inline CSS on an element with style=".."
is bad practice, people say to use a CSS rule in a stylesheet instead, via a HTML class. So it doesn’t make much sense to start styling things manually via javascript like that.
Instead, wouldn’t it make more sense to add a stylesheet that hides the title, then shows it when a CSS class is added to the main editor tag? Then add the class when your event is selected from the dropdown?
Additionally, you shouldn’t be doing this:
select("core/editor").loadedInit = true;
If you want to store data, there’s the WP Data API for that, and other alternatives.
Also, don’t use setTimeout
, use the window._wpLoadBlockEditor
promise to queue stuff up to run after the editor has been initialised instead, e.g.
window._wpLoadBlockEditor.then( function() {
console.log( 'hooray!' );
});
Related Posts:
- Gutenberg disable the “block” tab in right sidebar
- How to change the order of HTML output of a core block?
- Gutenberg – Add align controls to a custom block
- Gutenberg Block – Post Featured Image Filter Hook
- Set default value for “Additional CSS class(es)” for specific block types
- WordPress hooks/filters insert before content or after title
- How do filters and hooks really work in PHP
- Trouble understanding apply_filters()
- How would one modify the filtering Gutenberg applies to pasted content?
- Gutenberg: Is there a way to know if current block is inside InnerBlocks?
- How to add a custom CSS class to core blocks in Gutenberg editor?
- Filter hook before create order WooCommerce
- Changing text within the Block Editor
- wp_mail – Remove sitename from email subject
- Remove left alignment option in core/image block
- apply_filters() slices away needed arguments
- WP Rest API – Upload media without saving attachment post
- How to add attribute to output with wp_video_shortcode add_filter
- Anyway to edit the titlebar of WordPress Widgets in the Admin area?
- How to limit the pages displayed for choosing parent page on page attribute’s menu?
- How can I hide all posts that don’t have a thumbnail?
- Please explain me what the do_action does
- Is it possible to Hook/Filters Attachment Creation?
- How can I reliably and globally disable wptexturize?
- Customise Jetpack Publicize text
- WordPress RSS feed – filter RSS content by custom field value
- How to hook some Unicode texts into calendar widget safely?
- How to add attributes to tag when template cannot be directly modified
- filter the_title problem in nav
- How can I add a fifth option to the alignment picker?
- Filter the URL of next_posts_link & previous_posts_link
- Changing Gutenberg / WP block editor width only on pages, not posts or other taxonomies
- How to replace any occurence of Gravatars with a local placeholder image?
- How does WordPress call functions attached to a certain action hook before calling functions attached to other hooks
- Sensei LMS Hooks to Remove Content
- Customize user account activation message
- Conditionally call add_action depending on post_type?
- WordPress tag cloud add more links
- Add a header before fields added with the attachment_fields_to_edit() filter
- Error when overriding only some audio shortcode HTML output
- How can I filter block registration based on post-type? (Block alignment settings)
- When to use actions and when to use filters
- add_filter to ‘woocommerce_before_main_content’ [closed]
- Yoast SEO hooks overriding themselves
- Editing
- Is possible dequeue/remove style from wp_footer() hook and add on wp_head() hook?
- How to call a function or method that is Namespaced using another plugin
- Question about how do wordpress filters/actions work
- How to center oEmbedded content
- Change username before login
- How to change the order (priority) of registered filters (or actions) (e.g. for the_content)?
- How do I target a single page to modify the comment form of only that page?
- How to removes all instances of thumbnails displayed in my theme?
- Capture post content before page renders
- Can the wordpress color palettes by changed through Javascript?
- How to link the whole list item in Gutenberg’s latest posts block?
- add_filter(allowed_block_types) -> adding core/paragraph bugs Gutenberg editor
- How do I add a checkmark to my-sites save settings hook
- How to know what filter to use and how to use it?
- How to filter backend post list showing only posts having a shortcode
- Add Lightbox To WordPress Native Gallery
- What hooks to hook onto for automatic cache clearing
- Modify Redux Framework Options in Child Theme
- How to customize category_description()?
- How can I output all apply_filters and do_action?
- Is it possible to bind a function to a filter hook via Ajax?
- How do I hook my function to run only after submitting login form
- How to add a filter to the get_body_class function?
- Prepending character(s) to a custom tag title?
- How to hide/remove GhostKit component panel in gutenberg block inspector
- Modify existing plugin function with add_filter
- How to override include_once pointed file using add_filter?
- Remove tags without a specific meta key from “choose from the most used tags”
- What is the action hook to use if you want to capture the new password during password change?
- an action hook when a post reaches a certain number of views
- Action hook to control access to certain parts of my site
- Need to return shortcode text instead of the output
- Replace Data In Post & Update Meta Field Post Is Saved
- Filter Media by attached page or blog post in Library
- How to optionally append components to the output of a gutenberg block?
- How to add custom media library mime icons?
- WordPress Gutenberg core/heading block (wp-block-heading)
- How do I check if I can use the allowed_block_types filter?
- Add an attribute to the root from functions.php with add_filter
- Would like to use hook or filters to customize email templates
- Remove image of srcset
- Security question – Display a General Custom Login Error Message
- Filter wp_mail based on content type
- Add HTML to the bottom of each post in a post list
- Incrementing content with extra text after save/publish
- wp_editor customization
- WP Dashboard -> Posts-> Filter by Category -> Form Method Change : Which Hook
- Filter dashboard custom post listing by user
- Admin New Order: Autofocus on Search a product
- NextGEN Gallery: Adding drop-down menu widget to gallery view without modifying plugin code [closed]
- How to filter part of a variable if it is no array?
- How do you disable the verification process of user email changes?
- How to change this WP logo and posts url in block editor?
- Can you call a filter hook by “add_action”?
- How to elect position of new item output in a dropdown when using add_filter