January 14, 2012 3:01 PM   Subscribe

Wordpress is adding a secret break tag to my Google Button code, and it's driving me batty. No one on the Google forums helped with FIXING the problem, and the one suggestion I got on Facebook from a friend was bupkis. I turn to the hive mind so that I can fix this stupid problem.

OK, so I use the HTML editor - NOT THE VISUAL EDITOR - when I'm making posts to our blogsite webhome thingy. The page in question is here.

What I posted on the Google Help Forum is here, since I don't think I can post code on here? Regardless, long story short is that there is a break tag in the view source that does not show up in the editor. It's forcing the dollar sign to be on a different line than everything else, and it looks completely stupid. We're about to do a Kickstarter and I'd deeply prefer to not have some stupid amateur crap like this out in public. HALP.

Addendum - someone suggested editing the CSS in the theme - and I suppose we could do that - but I'd like to avoid changing the whole damn theme for just this ONE instance - an inline edit that we can apply on a case by case basis in posts or pages would be fine with me. I realize this isn't the best practice, probably. Thanks for your help.
posted by Medieval Maven to Computers & Internet (9 answers total)
Fastest way: If you want to put it in your sidebar, install the WP PHP plugin and stick your code in a WP PHP widget boxes. If you want to put in your content, install the Allow PHP in Posts and Pages plugin.
posted by DarlingBri at 3:07 PM on January 14, 2012


I added and enabled that plugin.

No dice. :(
posted by Medieval Maven at 3:13 PM on January 14, 2012

So, you've got a pre-baked code snippet that you're pasting into your blog content, right? Are you pasting it directly in-line with the preceding content, or are you inserting a new line before pasting? Because line breaks in your content are interpreted by Wordpress as <br>s, even when you're using the HTML editor: it's not a strict "you must enter valid HTML code for everything or it's a big ugly blob of text editor," it's a "we'll let you be lazy and treat line breaks as <br>s and double line breaks as <p>s editor."

Perhaps there's a line break in the code snippet itself causing this. You can strip all line breaks out of the code snippet and it will still work fine. So try that too.

Otherwise, yes, I'd use CSS. For one thing, I don't know why the $ is being represented by #x24—that seems really unfriendly. I'd strip that out and modify the CSS.

I note you've got some invalid HTML on that page. For one thing, you're repeating the id="item_price_1" in all of your amount input fields. But you can still select on that to add something like this:

#item_price_1:before { content: "$"; }
posted by adamrice at 3:34 PM on January 14, 2012

I'd make sure whatever you're putting in is valid HTML and then take the line breaks out of the code you're putting in. Maybe put a non-breaking space between the $ and the form field:

$&nbsp[input ... /]

(Pretend I didn't omit the ';' after '&nbsp')

I'd also double check to make sure that's not something the theme itself is doing.
posted by toomuchpete at 3:35 PM on January 14, 2012

Should have previewed. Using CSS for this is overkill, not the least of the reasons for which is that the :before selector does not work in IE <= 7.
posted by toomuchpete at 3:37 PM on January 14, 2012

This will take away WordPress's ability to auto-insert line breaks.

Be careful, though, because you will affect everything with making this modification.
posted by chrisfromthelc at 3:46 PM on January 14, 2012

Add this to your CSS:

#BB_BuyButtonForm td br {display: none}

This will hide the break tags inside the button forms only.
posted by clearlydemon at 4:55 PM on January 14, 2012 [1 favorite]

I was reading something about alternative WYSIWYG editors for Wordpress the other day that addressed some of the wacky garbage the default one does. I haven't installed any, so have no recommendations, but this may be worth you looking into, possibly through the plugins search.
posted by springbound at 6:10 PM on January 14, 2012

Thank you. That fixed it.

FWIW, the button code came right from Google. We didn't write the theme and my assumption, since the guy who did write it for us was a complete pain in the ass, is that we chose poorly and the universe only knows what garbage is in there.

I will cop to the line breaks and the div clears, though, but I'm willing to accept that I use a sledgehammer where a ball-peen might do. :)
posted by Medieval Maven at 6:52 PM on January 14, 2012

« Older Help spruce up my bathroom!   |   If only I were a girl, a red sash would do... Newer »
This thread is closed to new comments.