-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathfrontend-post-status-change.php
44 lines (41 loc) · 1.46 KB
/
frontend-post-status-change.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
//function to print custom status change buttons
function show_pause_button(){
?>
<form id="pause-<?php echo $post_id; ?>" name="front_end_pause" method="POST" action="">
<input type="hidden" name="pid" id="pid" value="<?php echo $post_id; ?>">
<input type="hidden" name="FE_PAUSE" id="FE_PAUSE" value="FE_PAUSE">
<input type="submit" name="submit" id="submit" value="Post deaktivieren">
</form>
<?
if (isset($_POST['FE_PAUSE']) && $_POST['FE_PAUSE'] == 'FE_PAUSE'){
$pid = $_POST['pid'] != '' ? $_POST['pid'] : '';
$post_stuff = array(
'ID' => $pid,
'post_status' => 'paused',
);
if ( $pid != ''){
wp_update_post( $post_stuff );
}
}
}
function show_resume_button(){
?>
<form id="resume-<?php echo $post_id; ?>" name="front_end_resume" method="POST" action="">
<input type="hidden" name="pid" id="pid" value="<?php echo $post_id; ?>">
<input type="hidden" name="FE_RESUME" id="FE_RESUME" value="FE_RESUME">
<input type="submit" name="submit" id="submit" value="Post aktivieren">
</form>
<?
if (isset($_POST['FE_RESUME']) && $_POST['FE_RESUME'] == 'FE_RESUME'){
$pid = $_POST['pid'] != '' ? $_POST['pid'] : '';
$post_stuff = array(
'ID' => $pid,
'post_status' => 'pending',
);
if ( $pid != ''){
wp_update_post( $post_stuff );
}
}
}
?>