Solved

Wordpress theme escaping double quotes

Posted on 2013-01-06
9
492 Views
Last Modified: 2013-01-11
I'm working with a WordPress theme named Realty. Everything is looking good except that I cannot reference images using the img tag. Below is what I get:

<img src=\"http://domain.com/wp-content/themes/realty/images/realtor.jpg\" />

As you can see the double quotes are getting escaped. I was reading about this issue and a fix is to turn the following parameters off:

magic_quotes_gpc      Off      Off
magic_quotes_runtime      Off      Off
magic_quotes_sybase      Off      Off

..And they are off in the phpinfo.php page.

Please let me know what I need to do to be able to use the img tag and the image to show in a browser.

thx!
0
Comment
Question by:paquicuba
  • 5
  • 3
9 Comments
 
LVL 23

Author Comment

by:paquicuba
ID: 38749490
I don't know if this make a difference, but the hosting is with godaddy.com
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 38749884
No, it does not make a difference.  There is not enough there to tell for sure but something in PHP may be running that thru 'addslashes' when it isn't needed.  Or is that coming from the database?  You may need to add a 'stripslashes' function somewhere to get rid of the extra backslashes.
0
 
LVL 1

Expert Comment

by:Shaun_King_23
ID: 38750412
in php when you use double back slash it skips processing that part of php so try

correct
<img src="http://domain.com/wp-content/themes/realty/images/realtor.jpg" />

incorrect
<img src=\"http://domain.com/wp-content/themes/realty/images/realtor.jpg\" />

hope this helps.
0
 
LVL 23

Author Comment

by:paquicuba
ID: 38752414
I have placed the stripslashes function in the functions.php of the theme and nothing...
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 23

Author Comment

by:paquicuba
ID: 38755524
OK. I removed the double-quotes completely and the images are now showing. My questions is: Will that affect the overall code?

Now it looks like this:

<img src=http://domain.com/wp-content/themes/realty/images/realtor.jpg />
0
 
LVL 1

Expert Comment

by:Shaun_King_23
ID: 38755705
problem with your img tag:

<img src=http://domain.com/wp-content/themes/realty/images/realtor.jpg />

should be
<img src="http://domain.com/wp-content/themes/realty/images/realtor.jpg" />

might affect your code due quotes missing.

example

---->  echo '<img src=http://domain.com/wp-content/themes/realty/images/realtor.jpg />';

could cause php to stop working or image will not be found because ...images/realtor.jpg/

is looking for a file or location which goes beyond the image file itself.

so use the fix i provided should fix the problem if there are any.
0
 
LVL 23

Author Comment

by:paquicuba
ID: 38756636
problem with your img tag:

<img src=http://domain.com/wp-content/themes/realty/images/realtor.jpg />

should be
<img src="http://domain.com/wp-content/themes/realty/images/realtor.jpg" />

I know it should be:

<img src="http://domain.com/wp-content/themes/realty/images/realtor.jpg" />

But my problem is that when I type the URL enclosed in double-quotes, Wordpress (NOT me) is escaping the double-quotes and creating the following:

<img src=\"http://domain.com/wp-content/themes/realty/images/realtor.jpg\" />

So, the above doesn't work either and I cannot find a solution to get rid of Wordpress behaviour.

Thx
0
 
LVL 1

Accepted Solution

by:
Shaun_King_23 earned 500 total points
ID: 38756932
i have tried using wordpress to edit a test script i have got but could not create the outcome your having.

so what i would do is try this bit of a pain but should work.
don't include the "http://www.site.com/"

<?php echo '<img src="wp-content/themes/realty/images/realtor.jpg">' ; ?>

if not working switch it.

<?php echo "<img src='wp-content/themes/realty/images/realtor.jpg'>" ; ?>

hope this helps.
0
 
LVL 23

Author Comment

by:paquicuba
ID: 38768081
Thanks a lot for trying, but nothing seems to work. I'll install a new theme...
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now