Applying custom css to a shortcode block
-
Hi, I have the following .php function to put a language switcher in my header.
/** * Polylang Shortcode - https://www.ads-software.com/plugins/polylang/ * Add this code in your functions.php * Put shortcode [polylang_langswitcher] to post/page for display flags * * @return string */ function custom_polylang_langswitcher() { $output = ''; if ( function_exists( 'pll_the_languages' ) ) { $args = [ 'show_flags' => 0, 'show_names' => 1, 'echo' => 0, ]; $output = '<ul class="polylang_langswitcher">'.pll_the_languages( $args ). '</ul>'; } return $output; } add_shortcode( 'polylang_langswitcher', 'custom_polylang_langswitcher' );
I used a Gutenberg shortcode block to apply the shortcode and it gives me this:
I want to disable the list view of the languages, and have them in one row next to each other. I wrote this in my style.css file:
/*
Theme Name: twentytwentythree-child
Theme URI:
Author:
Author URI:
Description:
Requires at least: 6.0
Tested up to: 6.2.2
Requires PHP: 5.7
Version: 0.0.1
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Template: twentytwentythree
Text Domain: twentytwentythreechild
Tags: blog, news, portfolio, one-column, wide-blocks, accessibility-ready, block-patterns, block-styles, custom-colors, custom-logo, custom-menu, editor-style, featured-images, full-site-editing, rtl-language-support, sticky-post, threaded-comments, translation-ready,
*/.lang-item{
display:inline;
padding-left:5px;
list-style:none;
}How do I apply the css to my shortcode in the Gutenberg editor?
- The topic ‘Applying custom css to a shortcode block’ is closed to new replies.