Solved

Wordpress theme escaping double quotes

Posted on 2013-01-06
9
494 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 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
 
LVL 23

Author Comment

by:paquicuba
ID: 38752414
I have placed the stripslashes function in the functions.php of the theme and nothing...
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Find out what you should include to make the best professional email signature for your organization.
The viewer will learn how to count occurrences of each item in an array.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

911 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

21 Experts available now in Live!

Get 1:1 Help Now