Skip to content

Instantly share code, notes, and snippets.

@CoachBirgit
CoachBirgit / divi-lightbox-snippet-for-functions.php
Last active January 19, 2022 06:33
DIVI: add lightbox to regular content images
/* --- DEPRECATED --- */
/* add .et_pb_lightbox_image clss to content images */
add_filter('the_content', 'divi_add_lightbox');
function divi_add_lightbox($content) {
global $post;
$pattern ="/<a(.*?)href=('|\")(.*?).(bmp|gif|jpeg|jpg|png)('|\")(.*?)>/i";
$replacement = '<a$1href=$2$3.$4$5 class="et_pb_lightbox_image" title="'.$post->post_title.'"$6>';
$content = preg_replace($pattern, $replacement, $content);
return $content;
}
<?php
/*
* Add font with icons to Getwid plugin.
* Use this code in functions.php or custom plugin.
*/
// add hook
add_action( 'getwid/icons-manager/init', 'my_theme_getwid_add_custom_icons' );
@oldrup
oldrup / remove_global_styles_and_svg_filters.php
Last active April 11, 2023 20:51
Remove Global Styles and SVG Filters from WP 5.9.1 - 2022-02-27
// Remove Global Styles and SVG Filters from WP 5.9.1 - 2022-02-27
function remove_global_styles_and_svg_filters() {
remove_action( 'wp_enqueue_scripts', 'wp_enqueue_global_styles' );
remove_action( 'wp_body_open', 'wp_global_styles_render_svg_filters' );
}
add_action('init', 'remove_global_styles_and_svg_filters');
// This snippet removes the Global Styles and SVG Filters that are mostly if not only used in Full Site Editing in WordPress 5.9.1+
// Detailed discussion at: https://github.com/WordPress/gutenberg/issues/36834
// WP default filters: https://github.com/WordPress/WordPress/blob/7d139785ea0cc4b1e9aef21a5632351d0d2ae053/wp-includes/default-filters.php
--paletteColor1 -----> --theme-palette-color-1
--paletteColor2 -----> --theme-palette-color-2
--paletteColor3 -----> --theme-palette-color-3
--paletteColor4 -----> --theme-palette-color-4
--paletteColor5 -----> --theme-palette-color-5
--paletteColor6 -----> --theme-palette-color-6
--paletteColor7 -----> --theme-palette-color-7
--paletteColor8 -----> --theme-palette-color-8
--fontFamily -----> --theme-font-family
@sergiu-radu
sergiu-radu / gist:3c73c51914b0b4a93fb3ef46259c1670
Created July 3, 2023 11:02
CSS for tag cloud legacy widget
[class*="tag_cloud"] {
.tagcloud {
display: flex;
flex-wrap: wrap;
gap: 8px;
a {
display: flex;
align-items: center;
height: 36px;