Last active
December 31, 2017 12:06
-
-
Save halusdm10/74155f9f72a4de6063a3ccb9fffd179e to your computer and use it in GitHub Desktop.
wordpress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Create an ad unit | |
//Place this code in a file functions.php | |
function wptuts_simple_ads( $ad_type ) { | |
switch ( $ad_type ) { | |
case "468x60": | |
$ad_code = "<!-- Ad code for a 468x60 advertisement. -->"; | |
break; | |
case "300x250": | |
$ad_code = "<!-- Ad code for a 300x250 advertisement. -->"; | |
break; | |
case "728x90": | |
$ad_code = "<!-- Ad code for a 728x90 advertisement. -->"; | |
break; | |
default: | |
$ad_code = "<!-- Ad code for the advertisement when 'ad_type' isn't specified. -->"; | |
} | |
$output = '<div class="wptuts_simple_ad ad-type-' . $ad_type . '">' . $ad_code . '</div>'; | |
return $output; | |
} | |
//After that, you can simply use this code anywhere in your topic: | |
<?php echo wptuts_simple_ads('468x60'); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment