Twenty Twenty-Four Theme, where to put the personalized CSS style rules?

YES (finally).. The specific answer for this template I found in a WP forum was a bit misleading, which took me hours lost searching for what they meant. So: The section for personalized CSS styles is located directly in “Twenty Twenty-Four” Theme Editor, just go: Appearance (themes); Editor (site-editor); Left Menu -> Styles (wp_global_styles); Up … Read more

Get generated block styles programmatically

We can look at the source of the wp_head() function: function wp_head() { /** * Prints scripts or data in the head tag on the front end. * * @since 1.5.0 */ do_action( ‘wp_head’ ); } And see that it really only calls the wp_head hook. We can then look through the WordPress core code … Read more

Embed dynamic media query in a Gutenberg block

If we stick to your exact example, I would define the value as a custom property in an inline style: <div class=”item” style=”–my-gap: <?php echo esc_attr( $attributes[‘gap’] ); ?>;”> Then in CSS use a media query to use the property as the appropriate margin: .item { margin-bottom: var(–my-gap); } @media ( min-width: 768px ) { … Read more

Wrong mime types served

OK, so with the help of the comments to my question and some more digging around I have found (what I think is) the correct answer: The apache config needs to have the headers module enabled (“a2enmod headers”) and the mime module (“a2enmod mime”) and the .htaccess file needs to have sections as follows: <IfModule … Read more

Style.css file gets restored to default version

Below is a generic response to help you, but first I want to give you my personal opinions based on my experiences with issues regarding using stylesheets with WordPress. I never use the themes generic style.css file due to issues like this and other common issues. Google no longer penalizes you for having extra .css … Read more

Calling a PHP function from a menu item

There’s a few things to consider here. 1) You should always first check for a third-party plugin like WPML. If, for whatever reason, WPML stops working or gets deactivated, assuming it’s there could result in a fatal error. function directByLang() { if( defined( ‘ICL_SITEPRESS_VERSION’ ) ) { $current_lang = apply_filters(‘wpml_current_language’, NULL); if ($current_lang == ‘en’) … Read more

Injecting CSS into Iframe

If the source of the iframe is not on the same domain as the page that the iframe is embedded on, you cannot change contents inside the iframe. If the iframe’s source is on the same domain, add the CSS directly to the source page. More: https://stackoverflow.com/a/36513940