?
Solved

Wordpress theme escaping double quotes

Posted on 2013-01-06
9
Medium Priority
?
500 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
Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

 
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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
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…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

777 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