Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

svg files fixed for theme path #3

Open
badabingbreda opened this issue Nov 3, 2018 · 1 comment
Open

svg files fixed for theme path #3

badabingbreda opened this issue Nov 3, 2018 · 1 comment
Assignees
Labels
awaiting-reply bug Something isn't working good first issue Good for newcomers

Comments

@badabingbreda
Copy link

Hi 7studio, great work!

One thing I noticed is that it assumes that the svg icons are in (a subfolder of) the theme folder. I was trying to add them packaged as a plugin but the str_replace() on the load_field() callback was preventing my icons from displaying.

I added two extra filters as a workaround to be able to set both search and replace parameters, now my svg can be located in that plugin-folder too.

@7studio 7studio self-assigned this Nov 5, 2018
@7studio 7studio added bug Something isn't working good first issue Good for newcomers labels Nov 5, 2018
@7studio
Copy link
Owner

7studio commented Nov 5, 2018

Hi @badabingbreda,

You are totally right and it's a stupid restriction. But it was out of my scope/need when I created the plugin 😅

The problem comes from the line 202 in fields/class-swp-acf-svg-icon-v5.php.

We can resolve the problem in two steps :

  1. Replace the current wrong line/behaviour by: $field['file']['url'] = str_replace( get_home_path(), home_url( '/' ), $field['file']['path'] );. This change should solve your problem.
  2. Offer three filters like acf/fields/svg_icon/file_path for the file URL (e.g.: acf/fields/svg_icon/file_url) to allow the use of an SVG file from a rewrited URL for example.

I hope you will appreciate this solution. I will try to fix this issue during the week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-reply bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants