forked from corgus/eas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
add_galleries.php
41 lines (31 loc) · 863 Bytes
/
add_galleries.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
<?php
/*
Template Name: Add Galleries
*/
$results = get_users(array('role' => 'artist', 'orderby' => 'registered'));
foreach ($results as $r) {
$these_posts = new WP_Query(array('author' => $r->ID, 'post_type' => 'forum'));
if ($these_posts->post_count == 0) {
$artworks = eas_artworks_by_user($r->ID);
$content = '';
foreach ($artworks as $a) {
$content.='
'.eas_artwork_url($a->ID).'
';
}
$new_post = array(
'post_type' => 'forum',
'post_date' => $r->user_registered,
'post_title' => $r->display_name,
'post_status' => 'publish',
'post_author' => $r->ID,
'post_content' => $content
);
$new_id = wp_insert_post($new_post);
wp_set_object_terms($new_id, 'gallery', 'forum_category');
eas_feature($new_id);
echo '<a href="'.trailingslashit(get_bloginfo('siteurl')).'art/'.$new_id.'">'.$r->display_name.'</a><br>';
}
/*
*/
}