- Open the WordPress admin control panel and navigate to:
Presentation > Theme Editor
- Select the Main Index Template from the list of templates on the right.
- In the Main Index Template, find the line that starts with:
<?php if (have_posts())
- Add the following line above it:
<?php $count = 1; ?>
- Next, find the line that starts with:
- After the closing tag ?> for that section (it may wrap to multiple lines), add the following code:
- <?php if ($count == 1) : ?>
– Insert your Google AdSense code here –
<?php endif; $count++; ?>
- Click Update File.
Embed Google Ad in First WordPress Post