Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Wordpress theme escaping double quotes

Posted on 2013-01-06
9
Medium Priority
?
502 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 84

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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 23

Author Comment

by:paquicuba
ID: 38752414
I have placed the stripslashes function in the functions.php of the theme and nothing...
0
 
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 2000 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

604 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