Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    You could hide any block element in the picker dialog with some custom admin CSS. For example:

    /* hide Amazon Kindle embed block */
    #id-tu4c97-109 {
        display: none;
    }

    It’ll be tedious listing all the various IDs, but it only needs to be done once. They at least follow a predictable pattern.

    Enqueue the resulting stylesheet with wp_enqueue_style() called from an “admin_enqueue_scripts” action callback. Obviously requires some custom coding. Custom code is best kept in your own custom plugin. It’s not as difficult to create one as it may sound.

    Thread Starter wotan6891

    (@wotan6891)

    Hello,

    thanks for your kind reply.

    I would like to know this:

    1. Do I have to put that css code in the css box in the wordpress theme customizer or in any css plugin?

    2. wp_enqueue_style () can I put it in the php plugin that I have installed and how do I put it?

    Sorry I don’t know much about code.
    Generally I look for codes and I paste them and there I see if they work. But I don’t know how to put together a code snippet.

    Greetings.

    Moderator bcworkz

    (@bcworkz)

    The customizer’s Additional CSS section only applies to front end requests. Admin CSS unfortunately is not so simple. Some CSS plugin might support admin CSS. It depends on the plugin. It’d be a nice plugin feature, but I suspect not that common.

    Enqueuing from a PHP plugin ought to work. Look at the user contributed notes near the bottom of the docs page for some example code. Any you choose will need modification. Instead of hooking “wp_enqueue_scripts” action like most examples, use “admin_enqueue_scripts” instead. Be sure the path to the .css file is correct for where ever you place the file. You don’t have too many places it can safely go without risk of it being deleted during updates. A plugin or theme that’s not subject to updates will work. But it’s better in your own child theme or plugin. Plugins are easier to create than child themes.

    Before making the effort to list all the ID selectors for almost every embed block, do a proof of concept test using only the CSS I provided earlier to ensure it properly hides that one block. If you have trouble getting your PHP working from the provided examples, post your best effort here and I’ll take a look at it.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Hide variations in the embed block’ is closed to new replies.