This
function wolpostcount_shortcode($atts) {
function object_to_array($object) {
if (!is_object($object) && !is_array($object)) {
return $object;
}
return array_map(\'object_to_array\', (array) $object) ;
}
$args = array(\'site__in\' => array(1,7,8,12,14,15,20,21,22,25,32,33,36,41,42,46,47,48,49));
$sitesObj = get_sites($args);
$sites = object_to_array($sitesObj);
foreach ($sites as $site) {
switch_to_blog($site[\'blog_id\']);
$postcount = wp_count_posts(\'post\')->publish;
$pagecount = wp_count_posts(\'page\')->publish;
echo \'Posts:\'.$postcount.\' Pages:\'.$pagecount.\'<br>\';
$totalpostcount = $totalpostcount + $postcount;
$totalpagecount = $totalpagecount + $pagecount;
restore_current_blog();
}
echo \'number of posts \'.$totalpostcount.\'<br>\';
echo \'number of pages \'.$totalpagecount.\'<br>\';