質問編集履歴
1
理由とかいらねーだろ
test
CHANGED
File without changes
|
test
CHANGED
@@ -75,3 +75,107 @@
|
|
75
75
|
|
76
76
|
|
77
77
|
アドバイスをお願いします。
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
【追記】
|
84
|
+
|
85
|
+
```
|
86
|
+
|
87
|
+
function publishSentMail ( $new_status, $old_status, $post ) {
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
if ( 'publish' == $new_status && 'publish' != $old_status && 'top_info' == $post->post_type ) {
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
global $post;
|
96
|
+
|
97
|
+
$args = array
|
98
|
+
|
99
|
+
(
|
100
|
+
|
101
|
+
'post_status' => array('publish')
|
102
|
+
|
103
|
+
);
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
$the_query = new WP_Query($args);
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
if ($the_query->have_posts())
|
112
|
+
|
113
|
+
{
|
114
|
+
|
115
|
+
$the_query->the_post();
|
116
|
+
|
117
|
+
$key = get_post_custom_keys($post_id);
|
118
|
+
|
119
|
+
$id = get_the_ID();
|
120
|
+
|
121
|
+
$meta_values = get_post_meta($id, $key);
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
}
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
mb_language("ja");
|
130
|
+
|
131
|
+
mb_internal_encoding("UTF-8");
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
$to = "*****@***.co.jp";
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
$subject = "タイトル";
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
$text = "$meta_values";
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
$from = "****";
|
148
|
+
|
149
|
+
$from_mail = "*************@****.co.jp";
|
150
|
+
|
151
|
+
$from_name = "****";
|
152
|
+
|
153
|
+
$header = '';
|
154
|
+
|
155
|
+
$header .= "Content-Type: text/plain \r\n";
|
156
|
+
|
157
|
+
$header .= "Return-Path: " . $from_mail . " \r\n";
|
158
|
+
|
159
|
+
$header .= "From: " . $from ." \r\n";
|
160
|
+
|
161
|
+
$header .= "Sender: " . $from ." \r\n";
|
162
|
+
|
163
|
+
$header .= "Reply-To: " . $from_mail . " \r\n";
|
164
|
+
|
165
|
+
$header .= "Organization: " . $from_name . " \r\n";
|
166
|
+
|
167
|
+
$header .= "X-Sender: " . $from_mail . " \r\n";
|
168
|
+
|
169
|
+
$header .= "X-Priority: 3 \r\n";
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
$response = mb_send_mail( $to, $subject, $text, $header);
|
174
|
+
|
175
|
+
wp_reset_postdata();
|
176
|
+
|
177
|
+
}
|
178
|
+
|
179
|
+
}
|
180
|
+
|
181
|
+
```
|