How to put codes in the wordpress content?
When you put some php, java codes in the wordpress content, they will appear not correctly after you have published them, then, how to put codes in the content?
Here is an easy way.
Just like these
<script type=”text/javascript”>
document.body.oncopy=function(){
event.returnValue=false;
var s=”";
clipboardData.setData(’Text’,s);
}
</script>
<?php if (count($posts) >= 3) { ?>
When you want put codes in wordpress, you should change the < to < , if you use the < , then the codes will not work.
just change the < to <
this method also works well in blogger, if you want to put adsense codes in blogger content, say wrap adsense ads in between blogger post content
following the steps: (this method is coming from scrapur.com)
- Login to Blogger account.
- At Blogger Dashboard, click on Settings link listed behind “Manage” for the blog that you want to enable to show AdSense ads between posts.
- Click on Template tab, and then click on Edit HTML sub-tab link to open Blogger HTML code template editor to edit the contents of your template.
- a copy of your template by click on Download Full Template link, in case it’s is needed be uploaded to Blogger server to recover the template in the event of mistake or corruption.
- Click to tick the Expand Widget Templates checkbox.
- Seach for the following line in the new Blogger template HTML code in the text box:<data:post.body/>or<p><data:post.body/></p>
- Append the following lines of code into the template BEFORE the line of <data:post.body/> located above:
Parsed Google AdSense Ad Code (guide to
parse the HTML code of AdSense JavaScript with escape character)Note the above code will align AdSense ad block to the left. You can also make it make it float to the right, but change the “float: left;” to “float: right;”.
Note that you can also make the ads appear only on single post view.
- Click on SAVE TEMPLATE button when done.
If the alignment of your blog layout is not good, you can try to add the code above directly after the following line in the Blogger widget template:
<div class=’post-header-line-1?/>
The above trick may work to add ad code wrap beside the post content in Blogger from other advertising networks too, such as AdBrite, BlogAds, Chitika, Tribal Fusion, ValueClick, and etc, in case you can’t use AdSense for reason such as account banned.