Created
December 11, 2014 18:48
-
-
Save ThomasKujawa/f1cba766e97613113999 to your computer and use it in GitHub Desktop.
Wordpress | Toolbox | #AD nach MORE-Break
This file contains 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 | |
/* | |
Module Name: Werbung nach dem more break | |
Module URI: http://linuxundich.de/webhosting/anzeige-nach-dem-more-break-einer-wordpress-seite-automatisch-einfugen/ | |
Description: Fügt nach dem MORE-Break Werbung oder Shortcode ein. [Frontend] | |
Author: Christoph Langner | |
Author URI: http://linuxundich.de/author/christoph/ | |
*/ | |
/* Sicherheitsabfrage */ | |
if ( !class_exists('Toolbox') ) { | |
die(); | |
} | |
/* Ab hier kann's los gehen */ | |
add_filter('the_content', 'adds_block'); | |
function adds_block($content){ | |
if (is_single()) | |
global $post; | |
$thePostID = $post->ID; // getting the post ID | |
$new_insert = '<span id="more-' .$thePostID.'"></span>' ; | |
return str_replace($new_insert, my_ad(), $content); | |
} | |
/* Anpassen an eigene Bedürfnisse */ | |
function my_ad(){ | |
return '</p><div class="single-google-ad">'.do_shortcode('[adrotate group="6"]').'</div><p>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment