Closed tinjure20 closed 2 years ago
After reviewing code examples from Automattic Blockbase and its child themes (Quadrant, Geologist, ..) I realized that I had to use get_stylesheet_directory()
instead of get_template_directory()
in my TT2-swiss functions.php
require statement. That seem to correct the problem. I have not yet fully tested using child theme style.css
for block styling but hopefully should work!
I thought to share my solution for the benefit of others.
Adding block styles via the theme is not considered best practice - particularly because users will lose that style when they switch themes. It might be better to suggest these as block styles in Gutenberg.
Thanks. Just for clarification, in this particular example, I was adding codes directly in TT2 theme for TESTING PURPOSE ONLY because the theme does not include registered block-styles.
Ah I see, makes sense :)
Description I have been playing with TT2 child themes with an aim to customize one of the TT2 child themes example and use in my personal project site.
One of the thing I am trying to do is register block styles in TT2 child theme to style some blocks differently via TT2 child
style.css
. Following TT1 Blocks, I was able to register block styles in TT2 theme and style via itsstyle.css
(see screenshot below).However, it failed to register the similar block style in TT2-swiss child using the same codes (see below).
In TT2-swiss I created
/inc
folder and copied the sameblock-styles.php
from TT2 and appendedrequire
statement in TT2-swissfunctions.php
file. I was wondering whether this was related to my local environment and it can be reproduced by others.A request to @kjellr: an example of registering
block-syle.php
and styling via childstyle.css
would greatly benefit for beginners to try and personalize TT2 child themes.