How to add css class to cloud tag anchors?

We can also modify the anchor CSS class with the wp_generate_tag_cloud_data filter (4.3+). With that filter we can modify the following anchor data: id url role name title (removed in 4.8) slug real_count class font_size formatted_count (added in 4.8) aria_label (added in 4.8) show_count (added in 4.8) The style attribute is hardcoded, as can be … Read more

How to override admin-bar style

You can override admin-bar with this function, don’t need to mess with admin-bar.css. Steps: Write your css Put inside the function (given below) Add this inside functions.php // customize admin bar css function override_admin_bar_css() { if ( is_admin_bar_showing() ) { ?> <style type=”text/css”> /* add your style here */ </style> <?php } } // on … Read more

Removing Default Gutenberg Blocks, But Keeping Reusable Block Functionality?

The reusable block is registered with the core/block name. I tried to add it to the allowed blocks in the allowed_block_types filter, here’s an example: add_filter( ‘allowed_block_types’, ‘wpse324908_allowed_block_types’, 10, 2 ); function wpse324908_allowed_block_types( $allowed_blocks, $post ) { $allowed_blocks = array( ‘core/block’, // <– Include to show reusable blocks in the block inserter. ‘core/image’, ‘core/paragraph’, ); … Read more

Modify Admin Bar Link

I’ve not worked with the admin-bar before. However, I found your question interesting and decided to take a look. If you add a function to handle the action hook ‘admin_bar_menu’ and set the priority to be higher than 70, you will have access to the raw admin_bar_menu nodes where you can modify the properties you … Read more

Where and how to put inline js in pages

You can add inline js by using the wp_add_inline_script function. function prince_scripts() { wp_enqueue_script( ‘prince-script’, get_template_directory_uri(). ‘main.js’); $hide_on_mobile = apply_filters( ‘prince_hide_on_mobile’, true ); $data=”var hideOnMobile = ” . ( $hide_on_mobile ? ‘true’: ‘false’ ) . ‘;’; wp_add_inline_script( ‘prince-script’, $data, ‘before’ ); } add_action( ‘wp_enqueue_scripts’, ‘prince_scripts’);

Relative URLs and hide /wp-content/themes/

The easiest way to move your theme folder is only via constant; include the wp-content folder. You can set a constant for the plugin folder and wp-content folder. Then is your plugins and themes in separete url, also in the include in the source of the frontend. like this example for my dev installs: define( … Read more

functions.php inject inline css

The easiest way I’ve seen is to echo it where you need it: function inline_css() { echo “<style>html{background-color:#001337}</style>”; } add_action( ‘wp_head’, ‘inline_css’, 0 ); Since 2019 you can also add styles inline inside the body, shown here without using echo: function example_body_open () { ?> <style> html { background-color: #B4D455; } </style> <?php } add_action( … Read more