User | Post |
9:16 am January 27, 2012
| retireby40
| | USA | |
| Member
| posts 1381 |
|
|
|
So sometime I need to add html to my blog. For example, I want to put the Google +1 button in this page.
http://retireby40.org/blog-rank/
I go to html view and add the code.
When I come back later to edit the page in the "visual" mode, the html would get messed up after I save.
Any tips from the wordpress experts?
Thanks a bunch.
-Joe
|
|
|
9:33 am January 27, 2012
| Eric – PersonalProfitability.com
| | Portland, OR | |
| Member
| posts 2120 |
|
|
|
The button shows up fine for me
|
|
|
10:43 am January 27, 2012
| Aloysa
| | |
| Member | posts 910 | |
|
|
I see the button just fine.
|
Creator of:
|
|
11:35 am January 27, 2012
| Tushar @ Everything Finance
| | Atlanta, GA, United States | |
| Member | posts 386 |
|
|
|
Once you add code in the HTML View, go ahead and save it first, before going to the "Visual" mode.
|
Tushar @ Everything Finance
Everything Finance
Email: tusharm at gmail dot com
Twitter: @AllFinance
|
|
11:47 am January 27, 2012
| retireby40
| | USA | |
| Member
| posts 1381 |
|
|
|
This is what I did to make it work.
But when I come back in the future in visual mode. I will need to insert the code again.
Is there a way to make the code stick?
Tushar @ Everything Finance said:
Once you add code in the HTML View, go ahead and save it first, before going to the "Visual" mode.
|
|
|
12:06 pm January 27, 2012
| Dividend Ninja
| | Vancouver B.C. | |
| Member | posts 198 |
|
|
|
Hi Joe (I'm not retired by 40),
There's two problems here, and its better to put a Google Plus One button directly into your template, or better yet use a plugin! It won't work, and here's why:
(1) Google uses its own markup language much like facebook does. It is primarily AJAX and JQuery based. Therefore when you pasted the code into an html editor (wordpress uses TinyMCE), the basic html editor doesn't know how to interpret it. It does the best it can, but it won't save the code, cause it doesn't know what to do with it.
(2) Until the latest release WordPress simply didn't save any html once you switched from html to page view. This was very annoying. Even now its not perfect – but it will do basic html.
SO the answer to your question is, don't bother – put Google Plus One into your template. Better yet use a plugin so you don't mess up the template!!! <– re-read that part. Havign said that Google Plus One is tricky to style and work with, hence I like a plugin for this one.
Hope that helps. Cheers!
|
|
|
12:51 pm January 27, 2012
| retireby40
| | USA | |
| Member
| posts 1381 |
|
|
|
Hi Dividend Ninja!
I see. I use a plugin for my regular posts, but for this page I want to +1 my main page. That's why I put it there.
Will it really mess up my template???
I saw this problem last year when I tried to add amazon affiliate codes to the html.
Thanks
|
|
|
3:42 pm January 27, 2012
| Suba @ Wealth Informatics
| | |
| Moderator
| posts 1876 |
|
|
|
Joe, this is a known problem with wordpress. With thesis you can easily add it to the custom functions instead of adding it to individual page. It happens especially when you are adding <scripts></scripts>. I think the Advanced TinyMCE plugin fixes this problem, but I don't like installing a plugin for occasional use. The best bet to is to add it to the custom functions. I have never tries the amazon widgets though, I just use the text link like any regular url.
|
|
|
6:42 pm January 27, 2012
| Glen Craig
| | |
| Member
| posts 1087 | |
|
|
I keep a text file handy with code I need to re-add in these situations. I have one page where this happens often with a piece of code.
|
|
|
8:55 pm January 27, 2012
| Dividend Ninja
| | Vancouver B.C. | |
| Member | posts 198 |
|
|
|
retireby40 said:
Hi Dividend Ninja!
I see. I use a plugin for my regular posts, but for this page I want to +1 my main page. That's why I put it there.
Will it really mess up my template???
I saw this problem last year when I tried to add amazon affiliate codes to the html.
Thanks
Hi retireby40, yes in this case you would want to put the code into the template since its a one time deal. Wrap the code in a div tag so you can modify and style it accordingly, i.e.
<div id="p-one-button">
THE CODE
</div>
|
|
|