Ich bekomme das meiste von dem, was im folgenden Code vor sich geht, mit Hilfe von http://www.php.net und http://codex.wordpress.org/Function_Reference/ .
In der aktuellen Situation triggers nur eine Seite der Website das Popup-Formular aus, wenn kein Cookie gesetzt ist. Ist diese functionalität in diesem Code angegeben?
Hier sind die functionen:
if (isset($_POST['confirm']) && isset($_POST['location'])) { setcookie("Location", $_POST['location'], time()+3600); } elseif (!isset($_COOKIE["Location"])) { setcookie("Location", "", 1); } elseif (isset($_POST['deny'])) { setcookie("Location", "", 1); } // Popup confirmation function show_popup($content) { global $post; $location = get_post_meta($post->ID, 'location', TRUE); if (strtolower($l) == strtolower($location) || strlen($location) == 0 || (isset($_COOKIE["Location"]) && strtolower($_COOKIE["Location"]) == strtolower($location))) { return $content; } else { ?> Foo.
Yes/No?
<form action="" method="post"> <input type="hidden" name="location" value="" /> <?php } } add_filter('the_content', 'show_popup'); // Adds content to the tag function add_meta_content() { if(isset($_POST['deny'])) { ?> <meta http-equiv="refresh" content="0;url="> <meta http-equiv="refresh" content="0;url="> <?php } } add_action('wp_head', 'add_meta_content');
'location'
Sie sicher, dass der Post als benutzerdefiniertes Feld mit dem Namen 'location'
und die Seite, die Sie gerade the_content()
, the_content()
Wenn Sie möchten, dass dies für Kategorien und Archive funktioniert, fügen Sie the_content()
hinzu:
add_filter('the_excerpt', 'show_popup');
hoffe das hilft