After the latest update of WordPress version 5.9, I saw that there was a svg files added at the bottom of the page. Can you please tell me, how to remove this? What's the use of it?
I am enqueuing some javascript that injects SVGs into my page's DOM (called SVGInjector); it works great except for one thing: there is an undesirable "blink"/shift of elements on my screen where the injected elements are placed upon loading. Apparently this blink has a name I found months after asking the question, it is called the Flash of Unstyled Content (or FOUC) and even has its own Wiki. The reason for this shift seems pretty clear: the page's other elements …
TLDR; Is there a way I can enable CORS for SVGs in my WordPress back-end, so I can get them through a http request to a different domain? Ideally without having to touch .htaccess? What I'm aiming for I am building a headless WordPress/React site. I would like to have my SVGs, uploaded to WP back-end, inlined into my front-end code (so I can access their DOM). I have URL to the SVG and react-inlinesvg library allows me to inline …
does anyone knows if it is possible to change the color (the stroke and fill attributes) of a SVG illustration used as a background with background-image: url() directly via CSS? Thank you
WP beginner here. I'm trying to upload an svg logo to my site. The logo can be accessed here. If you open it in the browser and inspect it, it should show the svg tags around the object. I've installed the SVG Support plugin and uploaded the image and set it as the logo of my theme. The logo is displayed in img tags but not as an svg. How would I change its color? What am I doing wrong?
I would like to have an svg downloaded from my site as a png. Searching I found this code and I must say that everything works. The site is a project that will only be viewed from mobile https://7c81b.wineqrcode.com/ and I would like you to change the size of the downloaded image. Currently the photo is generated based on the size of the svg. Is there any way to get around this? Thanks function downloadSVGAsPNG(e){ const canvas = document.createElement("canvas"); const …
I was trying to investigate how to replace some icons of the parent theme with the child theme but I was not able to do it. I am trying to replace the SVG icons that are in the twentytwentyone\classes\class-twenty-twenty-one-svg-icons.php file, specifically the Menu and Close icons. In my child theme I created the classes folder and copied the same svg icons file, but when I try to call it in my child theme functions.php, it doesn't work, I'm probably using …
I'm new, can I use include() or get_template_part to load an SVG file uploaded as featured image directly in the HTML page? I need to animate the svg images, but i need to easily change the image on each page. I have tried this code but does't work, I can't find the right path, I can load only the svg images in the same folder. $domain = get_site_url(); $svg_url = get_the_post_thumbnail_url(get_the_ID()); $svg = str_replace( $domain, '', $svg_url ); echo $svg; …
Replacing icon fonts with inline SVG icons seems to be strongly recommended by many developers these days. That makes sense for icons that can be hardcoded in theme files. But what about those that involve user-entered content? For example, perhaps you want the user to be able to add a class to a list when writing a post in the backend, and it changes to use custom SVG icons as bullets. Or perhaps all headings of a certain level need …
I have previously managed to utilise this block of code within my functions.php file to enable and create thumbnails for SVGs that are uploaded to my site: // ALLOW SVG function add_file_types_to_uploads($file_types){ $new_filetypes = array(); $new_filetypes['svg'] = 'image/svg+xml'; $file_types = array_merge($file_types, $new_filetypes ); return $file_types; } add_action('upload_mimes', 'add_file_types_to_uploads'); function common_svg_media_thumbnails($response, $attachment, $meta){ if($response['type'] === 'image' && $response['subtype'] === 'svg+xml' && class_exists('SimpleXMLElement')) { try { $path = get_attached_file($attachment->ID); if(@file_exists($path)) { $svg = new SimpleXMLElement(@file_get_contents($path)); $src = $response['url']; $width = (int) $svg['width']; …
I have created an SVG with clickable areas to be used as landing page image, The size of the file is 4 MB. I cannot upload it, Wordpess says there is an error (no specifics). Size seems not to be the problem, other files of this size are uploaded. I have the SVG Support plugin installed. I used lnkscape to create it. It looks fine in Edge and does what it is supposed to. I tried all SVG formats that …
I need to create a custom type post where will be added the name of the client and its logo. The logo will be added as a Featured Image. But the problem is that WordPress does not recognize the SVG size. What is an alternative fixing that? I tried to modify the CSS but it didn't work.
I have a block built in Gutenberg - in it I use an Icon element from '@wordpress/components' I use a single arrow to create a dropdown which renders as an SVG. Of course when anyone who is not a super admin or admin saves this block - then the SVG is stripped and the block breaks as no SVG is found matching the save() function. I don't want to whitelist all SVGs on a site for security reasons - so …
I have a plugin I created to allow for us to add additional image types (webp, svg, etc). For some reason it is failing and will not allow me to add svg. Could use an extra set of eyes on this one please: function pmp_custom_upload_mimes($existing_mimes = array()) { $existing_mimes['webp'] = 'image/webp'; $existing_mimes['ico'] = 'image/x-icon'; $existing_mimes['svg'] = 'image/svg+xml'; return $existing_mimes; } add_filter('mime_types', 'pmp_custom_upload_mimes');
I'm using ACF and have inside a loop: <?php echo wp_get_attachment_image( $button_image, 'small', 'sidebar-btn-icon', ["class" => "sidebar-btn-icon" , "alt"=> "sidebar icons"]); ?> This shows a svg icon. fill: #eee doesn't work because there is no direct path. Now I'm wondering how the change the color after a hover action?
Try to load external SVG icon with no html coding, just using my child functions.php file. I can get the icon with link to be "clickable", so link to e.g. Facebook is working, can set background color, so know it loads css file, but the icon does not show. I used Icomoon to get the external SVG. All files are now in the same folder as the functions.php file. In Icomoons help file it says: "After copying this SVG, you …
I want to include inline SVGs in a metabox textarea. That's easy. What's killing me is how do I sanitize the textarea before saving the postmeta, and how do I escape it? Halp? Thanks!
I addes this code to allow SVG Uploads to the Media Library of wordpress: function upload_svg ( $svg_mime ){ $svg_mime['svg'] = 'image/svg+xml'; return $svg_mime; } add_filter( 'upload_mimes', 'upload_svg' ); define('ALLOW_UNFILTERED_UPLOADS', true); Than I added some SVGs to the Media Library. Using them works perfectly fine. The only Issue I have is that they will not be displayed in the Media Library. On other Pages in the Backend they display fine. Is there anything I can do to display them in …
I am very new to Wordpress. I have an AI file and I am supposed to build a website out of it. Just have some difficulties in doing that. I select some slices in Adobe Illustrator and export them into a SVG file but it is like 1 or 2 megabyte. So, That's a bit too much for web. Also, What should I do to the texts that are placed besides the slices? When I export them they aren't shown …