use get_sites subsite_id with get_bloginfo”() and/or get_custom_logo

I inadvertently posted a duplicate of this question in the other stackexchange – but it was MISTAKENLY marked as duplicated and solved by a different question answered using deprecated code

So I will reask in the WordPress forum where there may be more expertise

I’m trying to combine functions – and don’t know how it is done

I’m successfully using get_sites to produce a list of WP Multisite subsites.

I’m hoping to also pull get_custom_logo to display the logo, and get_bloginfo for things like $site_description = get_bloginfo( ‘description’ );

just don’t know how to merge the gets. this is working

/** get sites */
function make_list_shortcode() {
$subsites = get_sites(
[
‘public’ => 1,
‘number’ => 500,
‘orderby’ => ‘last_updated’,
‘order’ => ‘DESC’,
]
);
if ( ! empty ( $subsites ) ) {
$html = ‘<ul class=”icon-bullets-greater”>’;
foreach( $subsites as $subsite ) {
$subsite_id = $subsite->blog_id;
$subsite_name = get_blog_details( $subsite_id )->blogname;
$subsite_link = get_blog_details( $subsite_id )->siteurl;
$subsite_domain = get_blog_details( $subsite_id )->domain;
$subsite_path = get_blog_details( $subsite_id )->path;
$html .= ‘<li style=”list-style: none!important;” class=”site-‘ .
$subsite_id . ‘” ><a href=”‘ . $subsite_link . ‘” target=”_blank”>’ .
$subsite_name . ‘</a> at ‘ . $subsite_domain . ” . $subsite_path . ‘ </li>’;
}
$html .= ‘</ul>’;
return $html;
}
}
add_shortcode(‘list_sites’, ‘make_list_shortcode’);

appreciate any help, thanks

Read more here:: use get_sites subsite_id with get_bloginfo”() and/or get_custom_logo

Leave a Reply

Your email address will not be published. Required fields are marked *