Simple:Press Documentation

FAQ: How to display ads in the forum

There are hundreds of different types of ads, affiliate services and different ways you can use ad placement to  monetize your forums.

Here are a few ways you can include some ads on your forum pages.

Place an ad at the top of the forum page

When the forums are setup there is a WordPress forum page created. In WordPress you can edit this page and add any text, html or other things to it the same as any other WordPress page. If you wished to display an ad  above your forums you can enter the code needed to display the ad, save it, and the add (or anything else you put there) will be shown at the top of all the forum pages.

Place an ad anywhere on a forum page

The easiest way to place ads on the forum pages is by using our ADS extension.

You can also choose to place an ad on a forum page by editing the template files that are included in the forum theme. You can read more about Simple:Press themes and customization on our Using Themes page and our Creating a Theme pages. All themes come with Template files included in the theme’s /templates folder.
You would choose which template folder and where you wanted the add to be placed and edit the template file itself.

Example of placing an ad in the forum footer

If you wished to place an ad in the footer of the forum you would edit and add the code directly to the theme’s spFoot.php file using a basic text editor not a word processing type of program.
For example placing a ad at the bottom of the footer after everything else you could use php to ‘echo’ out the code

sp_SectionEnd('', 'about');
echo 'my ad code here';
# Mandatory call to sp_FooterEnd() - available to custom code
# ----------------------------------------------------------------------
sp_FooterEnd();
?>

If you wanted to use raw text and html you could close the php tag, enter your code and then begin a new php tag.

sp_SectionEnd('', 'about');
# Mandatory call to sp_FooterEnd() - available to custom code
# ----------------------------------------------------------------------
?>
Raw text, Html or ad code here
<?php
sp_FooterEnd();
?>

Example of placing an ad to be shown after a topic post

You may want to display an ad after a particular number of posts have been displayed in a topic. If so you can edit the spTopicView.php file and add in a check to see which post is being displayed and then insert an ad.  For example if you wanted to show an ad after the first post and before the second post you could do something like this.

Open up the spTopicView.php file in your test editor and look for sp_SectionEnd(”, ‘post’); After that entry you can add this:

if($spTopicView->currentPost==1) {
echo 'my ad code here';
}

What that does is check and see if the post is number one and if so echo or display the ad. You can change the 1 in the example above to any number. If you wanted to add the advertisement after post number 4 you would change it to a 4.

You can also display an advertisement several times in a listing of posts.  For example if you wanted to display an advertisement after the first post and after the fourth post you could do this.

if($spTopicView->currentPost==1 || $spTopicView->currentPost==4) {
echo 'my ad code here';
}

This is just a few examples of adding advertisements to your forum. If you have a specific need please describe in detail what they are in the support forum and we will be glad to help.

More Topics In FAQ


Copyright © 2006-2019 Simple:Press. All Rights Reserved.