• Hi! I’m working on my first block theme and it’s giving me a lot of fun. I see there is a registered style in the block style tab to change the background image of the “row” block.. see the attached image below.

    I’m looking for that feature to be added to the “header” block as well. I had the ability to register some custom styles for the selected block using the “register_block_style” function, but I was unable to add such a style using this PHP function. I also looked for a way to do this using theme.json. Unfortunately I still have no luck.

    Hope somebody may help me out. Thank you.

Viewing 1 replies (of 1 total)
  • Thread Starter Tharanga Nuwan

    (@tharanga-nuwan)

    Hello, @aezazshekh Thanks you for your response. Unfortunately it didn’t help me much. Probably my explanation of the question is not clear enough for you.

    I have previous experience using the register_block_style function and used it to style some basic parts of my project. Below is the code I used to add a custom style to the core/list block using that function.

    register_block_style(
       'core/list',
       array(
         'name'         => 'arrow-list',
         'label'        => __( 'Arrow', 'twentytwentyfour' ),
         'inline_style' => ' ul.is-style-arrow-list {list-style-type: "\2618";}
                             ul.is-style-arrow-list li {padding-inline-start: 1ch;}
                             ul.is-style-arrow-list li::marker {color: var(--wp--preset--color--contrast-2);}
                                                    '
      )
    );

    What I really want is to add the background image to the core/heading block, just like it is done in the core/row block. See attached image below. (Actually, I missed that image in my question.)

    So, Can I know is there a way to get such a feature to the style tab on core/heading block?

    Thank you

Viewing 1 replies (of 1 total)

The topic ‘Registering a custom block style’ is closed to new replies.