-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcore.php
23 lines (20 loc) · 878 Bytes
/
core.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
/**
* Plugin Name: Content Warning Plugin
* Plugin URI: https://github.com/VolkanSah/Warning-function-for-WordPress/
* Description: This plugin adds a content warning to posts in specific categories.
* Version: 1.0
* Author: Volkan Kücükbudak
* Author URI: https://github.com/VolkanSah/
*/
function content_warning_filter($content) {
global $post;
if (has_category('example-category', $post->ID) && is_single()) {
// Überprüfen, ob die Warnung bereits gesehen wurde
if (!isset($_GET['warnung_gelesen'])) {
$content = '<p>The following post contains content that may not be suitable for all audiences. Reader discretion is advised. <a href="'.get_permalink($post->ID).'?warnung_gelesen=1">Klicken Sie hier, um weiterzulesen.</a></p>';
}
}
return $content;
}
add_filter('the_content', 'content_warning_filter');