I know this going to be very easy question for people with good PHP knowledge.
I have a WordPress website self hosted. I designed it for mobile devices and I would like to install Millennial Media advertisements in it. Millennial Media does not really provide detailed instructions and web resources strangely are not available!
I have knowledge in HTML,CSS and JavaScript but very poor in PHP :( . any way I can do some changes PHP to achieve what I want, but I can't write them from zero and integrate them by my self.
Ok long story short This the code provided by Millennial Media:
<?php
/*--------------------------------------------------------------*/
/* Millennial Media PHP Ad Coding, v.7.4.20 */
/* Copyright Millennial Media, Inc. 2006 */
/* */
/* The following code requires PHP >= 4.3.0 and */
/* allow_url_fopen 1 set in php.ini file. */
/* */
/* NOTE: */
/* It is recommended that you lower the default_socket_timeout */
/* value in the php.ini file to 5 seconds. */
/* This will prevent network connectivity from affecting */
/* page loading. */
/*--------------------------------------------------------------*/
/*------- Publisher Specific Section -------*/
$mm_placementid = 123456;
$mm_adserver = "ads.mp.mydas.mobi";
/* The default response will be echo'd on the page */
/* if no Ad is returned, so any valid WML/XHTML string */
/* is acceptable. */
$mm_default_response = "";
/*------------------------------------------*/
/*----------- BEGIN AD INITIALIZATION ----------*/
/*----- PLEASE DO NOT EDIT BELOW THIS LINE -----*/
$mm_id = "NONE";
$mm_ua = "NONE";
@$mm_ip = $_SERVER['REMOTE_ADDR'];
if (isset($_SERVER['HTTP_USER_AGENT'] )){
$mm_ua = $_SERVER['HTTP_USER_AGENT'];
}
if (isset($_SERVER['HTTP_X_UP_SUBNO'])) {
$mm_id = $_SERVER['HTTP_X_UP_SUBNO'];
} elseif (isset($_SERVER['HTTP_XID'])) {
$mm_id = $_SERVER['HTTP_XID'];
} elseif (isset($_SERVER['HTTP_CLIENTID'])) {
$mm_id = $_SERVER['HTTP_CLIENTID'];
} else {
$mm_id = $_SERVER['REMOTE_ADDR'];
}
$mm_url = "http://$mm_adserver/getAd.php5?apid=$mm_placementid&auid="
. urlencode($mm_id) . "&uip=" . urlencode($mm_ip) . "&ua="
. urlencode($mm_ua);
/*------------ END AD INITIALIZATION -----------*/
?>
<?php
/* Place this code block where you want the ad to appear */
/*------- Reusable Ad Call -------*/
@$mm_response = file_get_contents($mm_url);
echo $mm_response != FALSE ? $mm_response : $mm_default_response;
/*--------- End Ad Call ----------*/
?>
I want the Advertisement to appear in the footer area ( I will edit the footer.php in twenty eleven theme ) but I want to know where shall I put these pieces of codes in wordpress files or shall I create a new ones and what to name them?
would some please help me with this issue and provide me with the file's names that required to be edited and how would they look like in the end ?
Thanks
Anywhere in your page, where you want the ad to appear, let's say inside a
<div>
, use:This will make output of that file appear where
include
is.EDIT: Complete rewrite:
This is content of footer.php. I just installed wordpress for you, took 3 minutes. I edited footer.php including
<?php include('ads.php'); ?>
(see below), which appeared in footer, as expectedNow if you got a file from the ad company, change
ads.php
above to this file name. If you got a code pasted in (i don't know, an e-mail, website) - create a fileads.php
and paste whatever you got from them. Place that file intwentyeleven
subfolder. My file looks like this:and on the page it is like so: 1 http://www.spzozwolsztyn.internetdsl.pl/wpress.jpg
If you got tired of them remove include line from footer.php.