Solved

Wordpress theme escaping double quotes

Posted on 2013-01-06
9
498 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 83

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
Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

 
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 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
The purpose of this video is to demonstrate how to Import and export files in WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Click on Too…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

729 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