Pergunta

I have this code that I am using on a site to check if the current user has a blog on the our wp network and as of now it is echoing the URL for both the main site and their blog. I would like to know, how can I modify the code so that it only echoes for the user's site and not the primary/main site.

<?php if(is_user_logged_in()) {
global $current_user;
  $blogs = get_blogs_of_user( $current_user->id );
     if($blogs) {
         foreach ( $blogs as $blog ) {
         echo '<li><a href="http://' . $blog->domain . $blog->path .'/upload-and-manage-documents/">My Documents</a></li>';
         echo '<li><a href="http://' . $blog->domain . $blog->path .'upload-and-manage-documents/?ptype=settings&tab=gateways">Settings</a></li>';

        }
     }
} ?>

    <?php endif; ?>

So as of now instead of 2 links, it is echoing 4. How can I fix this?

Any help is appreciated. Thanks.

Nenhuma solução correta

Licenciado em: CC-BY-SA com atribuição
Não afiliado a wordpress.stackexchange
scroll top