Questions tagged [svg]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
14 views

How to use Illustrator AI file to design a Wordpress website

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 ...
0
votes
2answers
33 views

SVG not displaying in Media Tab in Backend

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', '...
0
votes
0answers
7 views

Embed SVG's from /uploads

Im trying to work out the best way to embed a SVG files content directly onto a php template segment within a theme. I have come across file_get_contents() but not sure how that would work with a ...
0
votes
1answer
46 views

Allowing SVG uploads in media uploader without plug-in

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 ...
0
votes
1answer
82 views

change with CSS the color of an svg background image set with “background-image: url()”

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
0
votes
0answers
13 views

Safe to use of SVG in a multi user blog in this scenario?

I want to upload SVG format site logo. I know uploading SVG creates possibilities of vulnerabilities. What I asking about the following scenario, When No-one can upload anything in the post (I prefer ...
0
votes
0answers
8 views

SVG files doesn't show dimensions anymore?

My Wordpress Media doesn't show SVG file dimensions. Do you know the problem? Before: After :
0
votes
2answers
109 views

SVG icons in Twenty Nineteen

The Twenty Nineteen theme uses SVG for its social icons. For example, this is the code for the Google icon: <svg viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="...
0
votes
1answer
29 views

SVG Upload to WordPress Issue

So I added this code to my Functions.php file and all of a sudden I can upload SVG's across my entire server, all my clients websites. I know there are security disclaimers regarding using this code. ...
0
votes
1answer
73 views

Swap SVG icons in child themes

The Twenty Nineteen theme uses inline SVG for its icons instead of icon fonts. The icons are added to the HTML code with the TwentyNineteen_SVG_Icons::get_svg() function. public static function ...
0
votes
0answers
75 views

Create Gutenburg Block to render inline SVG

I have been creating custom Gutenberg blocks for projects and I want to create a simple block to add inline SVG code that renders in the block builder and the front-end. Would I create a element to ...
0
votes
1answer
14 views

How can I change this SVG shape that's generated?

I have a website I'm customizing for a client, and I'll admit I'm not too skilled with generating SVGs. The site -- LINKED HERE uses a theme that has a built-in review feature and it currently uses a ...
1
vote
1answer
112 views

Featured Image .svg height and width 1px only

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 ...
0
votes
1answer
148 views

Wordpress Block.js SVG createElement

I have an svg image I have created with the following code as example: <svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 93.79 38.77"> <defs> <style&...
0
votes
2answers
444 views

Expected an identifier and instead saw '<'

I am having difficulty adding a custom svg icon to my Wordpress Plugin, I read on this page https://developer.wordpress.org/block-editor/components/icon/ that to add a custom svg icon to my plugin for ...
1
vote
1answer
30 views

Insert SVG code (not img) in HTML block

I want to insert svg code in a Guttenberg HTML block. I don't want it as an image because I want to manipulate it with CSS. If I insert svg, all tag diseappears and I have only the text which was ...
0
votes
1answer
28 views

import svg-files from wxr - (upload works, import not)

Upload works - Import from wxr not We're updating several sites with a new page, imported from a wxr file. Page, included form, jpg, png - all work fine but SVG not so much. I've checked scripts ...
0
votes
1answer
166 views

SVG in list-style-image breaks when adding fill

I'm trying to add a custom bullet using CSS list-style-image. Here is the attribute: ul { list-style-image:url("data:image/svg+xml;utf8,<?xml version='1.0' encoding='utf-8'?><svg width='...
1
vote
0answers
41 views

Add other social networks to TwentyNineteen_SVG_Icons class in child theme?

I'm trying to add items to the $social_icons_map and $social_icons arrays in class-twentynineteen-svg-icons.php I know I need to do it in the functions.php file of my child theme. I think I need to ...
0
votes
1answer
894 views

Add custom SVG icons to Social Icon MENU in WordPress Twenty Seventeen Child Theme

I'm having trouble adding custom SVG icons to the Social Icon Menu in WordPress Twentyseventeen Child Theme.The menu works fine with all pre-packaged SVGs included with the theme, but I can't add ...
0
votes
2answers
772 views

Why does SVG upload in Media Library fail if the file does not have an XML tag at the beginning?

I have enabled SVG uploads using this code: add_filter('upload_mimes', function($mimes) { $mimes['svg'] = 'image/svg+xml'; return $mimes; }); However, uploads of SVG files that start with the &...
0
votes
1answer
222 views

Are SVG image files safe to upload? Why WP defines them as a security risk? [duplicate]

I'd like to upload a map of the USA in a SVG format however I am prevented from doing so because of a 'security risk'. Any ideas why this is? Is it safe to do so? Thanks
1
vote
1answer
632 views

Adding extra SVGs to TwentyNineteen child theme using class TwentyNineteen_SVG_Icons

I’m trying to change the svg of the ellipses for the mobile menu. It’s called in this file: template-functions.php so I did a hook on my child theme functions.php to replace it, like so: function ...
0
votes
1answer
17 views

Add a svg and show some text on the parts of that view when the user hover or click on that part in WordPress

I am working in my WordPress website and I want to add a svg to my website and show some text on the parts of that view when the user hover or click on that part in WordPress. I have searched a lot ...
0
votes
1answer
22 views

Replace Home with image link inside custom header menu

What I want to achieve is a header menu like this: Right now, I have this: I am not far off. To get to where I am currently at, I followed these instructions and added some custom CSS. So I added ...
1
vote
2answers
1k views

SVG Featured image not shown in twitter

I have a post with a featured image (size 736x212). The post url is this. I shared my post on twitter, but the tweet doesn't show the image (if you want to check click here). What could be the problem?...
2
votes
1answer
146 views

getting uploaded SVG dimensions on front-end

Having successfully uploaded an SVG image through WordPress's back-end media uploader with the help of a third party plugin such as Safe SVG by Daryll Doyle, how can one get the image's dimensions ...
0
votes
1answer
234 views

Wordpress search form and input type=“image”

I need help with this code. How can I get the search field to display when clicking on the search-icon.svg? <form role="search" method="get" class="search-form" action="<?php echo home_url( '/...
6
votes
6answers
8k views

How to upload SVG in WordPress 4.9.8?

I tried uploading after installing different plugins. Even added a filter to functions.php file. function add_svg_to_upload_mimes( $upload_mimes ) { $upload_mimes['svg'] = 'image/svg+xml'; ...
0
votes
1answer
792 views

Enable CORS for getting an inline SVG by URL

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 ...
3
votes
2answers
1k views

Escaping SVG with KSES

I'm trying to output an SVG file in a template, and PHPCS is telling me I need to escape the output. So I tried with KSES and it doesn't seem to want to include the viewbox attribute. $allowed_html =...
3
votes
1answer
382 views

Tiny MCE editor stripping xlink:href parameter from SVG USE tag

I have an inline SVG tag with an embedded <USE> tag. HTML: <ul> <li><svg class="icon-user"><use xlink:href="#icon-user"></use></svg> My Account</li>...
0
votes
1answer
3k views

Can you change the color of svg icons to the global color I choose from Wordpress

For example If I make svg icons that are grey and violet, when I change the global color scheme on wordpress, Is it possible to make it work so if the main color scheme was violet, and I change the ...
0
votes
2answers
853 views

How to implement my own icons instead of using the svg icon system

From WordPress 4.9.2, I created a child theme for twentyseventeen. I noticed that it comes with its own SVG icon system for social media icons at the bottom of the page. I see some of that code ...
1
vote
2answers
1k views

Disable automatig SVG tag from menu

I'm using twentyseventeen theme as base to design my own, but when i use wp_nav_menu to print menus, it adds some unwanted svg elements which break my design. Elements are like: <svg class="icon ...
6
votes
1answer
250 views

Escaping and sanitizing SVGs in metabox textarea

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!
4
votes
2answers
8k views

How to Include SVG sprites icons into the body tag? [closed]

I want to include an SVG icon file after the body tag and I'm using this code: <?php include_once("assets/img/sprites.svg"); ?> But I get this error: Parse error: syntax error, unexpected ...
2
votes
1answer
809 views

Set media metadata (i.e. “dimensions” field) on SVG file after extracting it with a filter

My question is about how to attached the size dimensions I have successfully extracted from an SVG and force them into the WP 'dimensions' field associated with the file, so that the dimensions appear ...
7
votes
2answers
3k views

Can't extract and set SVG dimensions

Up to now, I have had no problems with the background-image thumbnails in my theme. However, now that I'm trying to use an SVG as the featured image, something is breaking. The problem seems to ...
2
votes
2answers
2k views

SVG image upload stopped working

I have a client website that has the mime type support for SVG's added in the functions file. We've been uploading svg's for over a year. Suddenly it stopped working and is showing the "for security ...
5
votes
2answers
7k views

Cant upload SVG files after updating Wordpress 4.7.1 [duplicate]

I updated Wordpress to 4.7.1 and cant upload SVG anymore. I had a function in my functions.php file function cc_mime_types($mimes) { $mimes['svg'] = 'image/svg+xml'; return $mimes; } ...
17
votes
3answers
4k views

SVG files not uploading since most recent WP update

I have a snippet in my functions PHP file that allows me to upload SVG files. Since upgrading to the latest version of WP today, I can no longer upload svgs. I also tried a second code snippet from ...
0
votes
3answers
801 views

How to delay display of page elements until enqueued script has injected html

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 ...
1
vote
2answers
3k views

Stylizing external SVG files with jQuery and CSS

I have enabled SVG-file-linking on my WP site using the Safe SVG plug-in, and I'm mostly happy with it. However, I'm having an issue with styling the SVG-paths contained in the external-file I am ...
4
votes
2answers
5k views

Understanding SVG vulnerabilities in Wordpress related to a specific fix

I have enabled SVG uploading for my Wordpress logo using the answer provided on this stack link, despite having read, in numerous places, that SVG support in a Wordpress site opens it up to scripting ...
5
votes
1answer
2k views

Issue with wp_get_attachment_image() and SVG file type

I'm trying to use SVG image with wp_get_attachment_image() but it is generating very weird output at the front end of the website. To support SVG file type I've first added the following function in ...
2
votes
2answers
5k views

How to use a svg as custom header?

I want to use a svg as a custom header in WordPress. I tried two ways: First I want the user to be able to upload their own svg as a custom header. So I enabled svg uploads in the functions.php: ...
0
votes
2answers
2k views

Allow SVG in WP step by step

I'm not strong in WP programming, bu I try to understand what to do to enable SVG in my site. I found that in need to add function below to functions.php: /** * Add SVG capabilities */ function ...
0
votes
1answer
49 views

Querying a large number of posts including their custom fields data

I'm building a SVG map separated into about 200 regions. For each region there are attributes that describe it, as well as a region ID. These regions are just polygons in the SVG. I setup a custom ...
15
votes
1answer
1k views

For what security reasons are svgs blocked in the media uploader?

I see that SVGs are blocked by default in the media uploader and you have to add it as a supported MIME type in functions.php. What security reasons are behind this?