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 | |
/** | |
* Advanced Ads – Company Category | |
* | |
* @wordpress-plugin | |
* Plugin Name: Advanced Ads – Company Category | |
* Plugin URI: https://wpadvancedads.com | |
* Description: Add a Company category to ads so that you can group them. | |
* Version: 0.1 | |
* Author: Thomas Maier |
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
/** this code allows to reserve ad space with a ratio, e.g., when width is 100% and height needs to be adjusted dynamically | |
https://www.w3schools.com/howto/howto_css_aspect_ratio.asp | |
"top-banner-ads" is the class of the main container, in Advanced Ads derived from the placement name | |
**/ | |
.top-banner-ads { | |
width: 100%; | |
height: auto; | |
padding-top: 12.4%; /* 728:90 ratio */ | |
position: relative; | |
} |
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
function adblock_alert(){ | |
?><script type="text/javascript"> | |
jQuery(document).ready(function($) { | |
setTimeout(function(){ | |
if ( ba_blocked == true ) alert("You are using adblock."); | |
},200) | |
}); | |
</script><?php | |
} | |
add_action('wp_footer', 'adblock_alert'); |
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
<!-- the id must match the id defined in the slot --> | |
<!-- style attribut is optional, but useful to prevent to shift layout after ad is loaded --> | |
<div id="banner1" style="width:300px; height:250px;"> | |
<script type="text/javascript"> | |
// id 'banner1' is used here, again | |
googletag.cmd.push(function() { googletag.display('banner1'); }); | |
</script> | |
</div> |
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
/* LOG FUNCTION */ | |
function log( $input ){ | |
$time = date('d-m-Y H:i T'); | |
$file = get_template_directory() . '/log.txt'; | |
$handle = fopen($file, 'a'); | |
$data = '--------------- ' . $time."--------------- \r\n".$input."\r\n"; | |
fwrite($handle, $data); | |
fclose($handle); | |
} |
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
public function __construct () { | |
// other code... | |
add_action( 'user_profile_update_errors', array( $this, 'remove_empty_email_error' )); | |
} | |
function remove_empty_email_error( $arg ) { | |
if ( !empty( $arg->errors['empty_email'] ) ) unset( $arg->errors['empty_email'] ); | |
} |
NewerOlder