mirror of
https://github.com/yunluo/gdk.git
synced 2024-05-04 23:43:23 +02:00
更新
This commit is contained in:
parent
27c1b9597d
commit
0b53a80dad
|
@ -584,6 +584,7 @@ jQuery(function ($) { /**声明加载jQuery */
|
|||
var ajax_data = {
|
||||
action: $("#msg_submit").data("action"),
|
||||
mail: $("#msg_mail").val(),
|
||||
only_mail: $(".only_mail").length,
|
||||
msg_content: $("#msg_content").val(),
|
||||
msg_nonce: gdk.msg_nonce
|
||||
};
|
||||
|
|
|
@ -375,17 +375,20 @@ function msg_form()
|
|||
exit('403');
|
||||
}
|
||||
|
||||
|
||||
$msg = array(
|
||||
'post_title' => '【来自' . $_POST['mail'] . '留言】',
|
||||
'post_author' => 1,
|
||||
'post_content' => $_POST['msg_content'],
|
||||
);
|
||||
// 将文章插入数据库
|
||||
$status = wp_insert_post($msg);
|
||||
if ($status != 0) {
|
||||
wp_mail(get_bloginfo('admin_email'), $msg['post_title'], $msg['post_content']);
|
||||
exit('200');
|
||||
}
|
||||
|
||||
wp_mail(get_bloginfo('admin_email'), $msg['post_title'], $msg['post_content']);
|
||||
|
||||
if($_POST['only_mail'] !== '1'){
|
||||
wp_insert_post($msg);
|
||||
}
|
||||
exit('200');
|
||||
|
||||
}
|
||||
add_action('wp_ajax_msg_submit', 'msg_form');
|
||||
add_action('wp_ajax_nopriv_msg_submit', 'msg_form');
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
<?php
|
||||
|
||||
|
||||
function gdk_rand_color() {
|
||||
$arr=array("red","green","blue","yellow");
|
||||
$rndKey = array_rand($arr);
|
||||
echo $arr[$rndKey];
|
||||
}
|
||||
/**
|
||||
* 获取摘要
|
||||
*/
|
||||
|
@ -1273,7 +1279,6 @@ function gdk_post_dropdown()
|
|||
/* Option list of all post */
|
||||
$gdk_options_posts = [];
|
||||
$gdk_options_posts_obj = get_posts('posts_per_page=-1');
|
||||
$gdk_options_posts[''] = '选择文章';
|
||||
foreach ($gdk_options_posts_obj as $gdk_posts) {
|
||||
$gdk_options_posts[$gdk_posts->ID] = $gdk_posts->post_title;
|
||||
}
|
||||
|
@ -1293,7 +1298,6 @@ function gdk_categories_dropdown()
|
|||
);
|
||||
$gdk_option_categories = [];
|
||||
$gdk_category_lists = get_categories($gdk_args);
|
||||
$gdk_option_categories[''] = '选择分类';
|
||||
foreach ($gdk_category_lists as $gdk_category) {
|
||||
$gdk_option_categories[$gdk_category->term_id] = $gdk_category->name;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue