Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Cynthia (Sunni) Freyer
Cynthia (Sunni) Freyer
828 Points

Odd One: quote mark issue

I have an odd problem. I'm learning how to build a wordpress bootstrap theme. I have typed [ a class="btn btn-primary btn-lg" role="button" ] within the wordpress admin page text area (using text view).

When that page displays in my firefox 35.0 browser, the text displays rather than the result of the code.e.g, this displays:

[ a class=”btn btn-primary btn-lg” role=”button” ]

In Firebug (and just looking at the above text), I found the problem: It's the quote marks! They are curly marks rather than straight.

If I type within Firebug the correct type of quote marks, the button displays properly.

However, I cannot for the life of me get those quote marks to be used from by typing them within the admin. area text box for that page.

I'm working on a local dev. site -- Apache server on a win 7 machine.

totally lost on this one. Anyone have a suggestion as to where to start? Yes, I disabled all plugins, hoping that would solve the problem. But nope..

Cynthia (Sunni) Freyer
Cynthia (Sunni) Freyer
828 Points

Even more fun found. I typed the same code on another page. It displayed properly. That page, though, is calling a different template. I am noticing that when I call the custom static home page, that is causing the quote marks to be rendered as curly quotes. In fact, when I look at source code, I see they are being converted to hex code while on the other static page, they are not converted:
<!-- add the loop --> <p><a class=”btn btn-primary btn-lg” role=”button”> Learn more </a></p> <h1> hello world!</h1>

Hmmm. Anyone have a clue?

3 Answers

Cynthia (Sunni) Freyer
Cynthia (Sunni) Freyer
828 Points

Hey Sean -- Got it figured out, thanks to your help, and learned something new about Wordpress, in the process. I'm using pages in both instances but they were calling different templates, which I thought was the source of the problem. Both were set up to call content from the admin text box.

Sure enough, I went to the custom static page where quote marks displayed properly and when I typed in the same <a> code using the WYSIWYG view in the admin, it displayed in the browser with curly quotes while when I typed it in directly in the ascii text editor, it displayed correctly. I had copy/pasted from the WYSIWYG into the text editor and that brought the problem into the text editor, interestingly enough. When I did it the reverse way, no problem. So yep, you're right -- it's the Wordpress core code that is the culprit. What a feature!!

(I used the square brackets just to set off the code here. Wasn't sure how to insert code here )

Thanks much!!

Sean T. Unwin
Sean T. Unwin
28,690 Points

Great work, Cynthia. Happy to help. :)

You can check out this thread to see how to insert code in a post here.

Happy coding!

Sean T. Unwin
Sean T. Unwin
28,690 Points

Wordpress displays curly quotes when rendering content.

The following are a couple of ways to disable this 'feature'.

http://www.smashingmagazine.com/2009/08/18/10-useful-wordpress-hook-hacks/ - See #1.

http://www.fayazmiraz.com/disable-auto-curly-quotes-in-wordpress/

Cynthia (Sunni) Freyer
Cynthia (Sunni) Freyer
828 Points

Hey Sean -- Thanks for the help. Trying to figure out why it's working on one page in WP but not on another. If I hadn't found the other page, I'd be a happier camper. I'll take a look at smashing article but since it works on one but not the other, the problems got to be in the code of the custom page, I think...

Sean T. Unwin
Sean T. Unwin
28,690 Points

On the static page you are editing the page's code directly and with the case in your original post (here I mean) you are editing/ creating a post, is that correct? And in both cases you are using the editor from within the admin?

Sean T. Unwin
Sean T. Unwin
28,690 Points

Furthermore, in your first post you are using square brackets, and your post you show angled brackets. Are you using different views for each (i.e. code vs text)?