Textpattern tips, tutorials and code snippets

Google AdSense

Adding Google AdSense ads is easy in Textpattern. Following the same procedure as the previous tip on creating re-usable headers and footers, we simply use a form to output the Google AdSense ads.

Create a new form called “google_textads” and set type to “misc”

This form should contain the Google AdSense code, something like the code below.

<div class="google">
<script type="text/javascript"><!--
google_ad_client = "your publisher id here";
google_ad_slot = "7410366493";
google_ad_width = 120;
google_ad_height = 90;
<script type="text/javascript"

Output the form in your page where you want the ads to appear

<div id="textads">
<txp:output_form form="google_textads" />
Use Textile help to style your comments