To include ads (or any other type of content) in this theme, you only need to copy any given code into any of the files of this directory, depending on where you want them to show up (file names are self-explanatory on this matter). Just take into account that most ad blocks will appear just once, except the following. After-post*.php and before-post*.php files will repeat for every post returned (just one in single post or page view, usually more in index, archives, categories...). After-post-paragraph.php and before-post-paragraph.php will repeat after/before every paragraph (
,
and tags) for each post returned. After-comment*.php and before-comment*.php will repeat for every comment returned (just in single post or page view).
Before-body-close-tag.php, after-body-open-tag.php and before-head-close-tag.php files are useful for including the JavaScript code required by some services (web stats, tracking, etc)
You can add elements to the horizontal menu with the after-menu.php and before-menu.php file. Just remember to include them as list items, for instance:
- Another section
You can use PHP and Wordpress built-in functions and variables so you can target your ads to any specific type of placement.
You can add additional styles at the beginning or the end of the external CSS file thanks to the before-css.php and after-css.php files. Being an external file, WordPress functions won't be available for these files (though the theme functions used in style.php will be). Analogously you can add additional code to the external JavaScript file thanks to the before-js.php and after-js.php files (again, WordPress functions won't be available for these files).
For AdSense users I recommend using a leaderboard in the after-header.php file and banners for the first 2 posts in an after-post*.php or before-post*.php file.
*** USEFUL VARIABLES ***
(after-post*.php or before-post*.php files)
$wp_query->current_post - Current post number, starting by 0
$wp_query->post_count - Total amount of posts returned
$wp_query->current_paragraph - Current paragraph number, starting by 0
$wp_query->paragraph_count - Total amount of paragraph in the current post
(after-comment*.php or before-comment*.php files)
$wp_query->current_comment - Current comment number, starting by 0
$wp_query->comment_count - Total amount of comments returned
*** USEFUL FUNCTIONS ***
is_home() - Returns true when on the homepage, false otherwise
is_404() - Posts not found
is_single() - Single post
is_page() - Single page
is_category() - Category posts
obt_is_tag() - Tag posts (when using Simple Tagging Plugin)
is_author() - Posts for a given blogger
is_date() - Posts for a given year/month/day
is_search() - Search results
*** SOME SAMPLES ***
- DISPLAY ADS ONLY IN THE FIRST 2 POSTS (after-post*.php or before-post*.php files)
current_post < 2){ ?>
...here your HTML code...
- DISPLAY ADS ONLY IN THE LAST POST (after-post*.php or before-post*.php files)
current_post == ($wp_query->post_count - 1)){ ?>
...here your HTML code...
- DISPLAY ADS AFTER THE FIRST PARAGRAPH IN THE FIRST 2 POSTS (after-post-paragraph.php)
current_post < 2 && $wp_query->current_paragraph == 0){ ?>
...here your HTML code...
- DISPLAY ADS BEFORE THE LAST PARAGRAPH IN THE FIRST 2 POSTS (before-post-paragraph.php)
current_post < 2 && $wp_query->current_paragraph == ($wp_query->paragraph_count - 1)){ ?>
...here your HTML code...
- DISPLAY ADS ONLY FOR A GIVEN CATEGORY
...here your HTML code..
- DISPLAY ADS ONLY FOR A GIVEN TAG (when using Simple Tagging Plugin)
...here your HTML code...
- DISPLAY ADS ONLY FOR A GIVEN BLOGGER PAGE
...here your HTML code...
- DISPLAY ADS ONLY FOR A GIVEN SEARCH
...here your HTML code...