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

How to remove quote marks from string --- > "

HTML tags are not being rendered in browser ...because Custom Fields plugin puts quotation marks around my HTML code.

See image: http://bikeep.com/images/problem.png

plugin uses the_field( 'intro_text' ); to output this

How to delete these " " marks?

Maybe i can use some php function like? str_replace()

    <h1><?php the_field( 'intro_title' ); ?></h1>

    <?php the_field( 'intro_text' ); ?>
Ben Dickie
Ben Dickie
1,559 Points

Hi kristjan

Are you using ACF plugin? if so have you tried

echo '<p>' . get_field('intro_text') . '</p>';

and are you using a visual editor?

I am using :

  • Advanced Custom Fields | Version 4.1.6 | By Elliot Condon
  • Custom Post Type UI | Version 0.8 | By WebDevStudios.com

I tried using different fields TEXT / WIZWIG / TEXTAREA FIELD and i tried NO FORMATTING, AUTO <br /> and HTML formatting checkbox None of them did not work... my point was to make area where client can enter basic html txt formatting

Ben Dickie
Ben Dickie
1,559 Points

Hi kristjan

Just tested it using ACF with the wysiwyg editor seems to format the code fine no extra <p></p> or "", is there something else that might be causing this?

5 Answers

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Are you adding the HTML inside of the code view of the WYSIWYG?

yes. HTML is inserted through WYSIWYG editor... also tryed other field types like text and text area..

problem is the same :S

You could try this, trim(string, charlist)

<h1><?php the_field( trim('intro_title', '"' ); ?></h1>

Not familiar with the plug in you are using, so I don't know if it will work.

missgeekbunny
missgeekbunny
37,033 Points

Custom Fields is not for content like that. It was designed with a basic user wanting to put plain text in there. You will probably want to find a different plugin that allows you insert html. I used to have one on one of my blogs but I can't remember the name of it and I only dropped the plugin a month ago when I switched hosts and entirely revamped my site. So you have current options. But I would really just try to find one that allows an html field.

maybe it possible to remove this function what adds these marks... Maybe anyone can recommend plugin so that client can insert basic HTML ...

Easy solution would be to make widget area... But everything else in on dashboard.

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

If you don't use HTML does it do the same thing?

I have some kind of solution.. with WYSIWYG editor, it has "edit HTML SOURCE" button... if i edit from there everything will be as needed..

Zac Gordon
Zac Gordon
Treehouse Guest Teacher

The WYSIWYG is infamous for stripping tags. But adding the quotes is a little unusual.

Sometimes however, if you change a field type after adding content it can cause some quirks