Is it possible to have a list of all site available on the main site?

Is it possible to have a list of all sites available on the main site?

Maybe a list of like the categories or a dropdown categories?

Es would also nice to have a search for the sites available on the main sites.

thanks.

Pat

  • Jorgen Juel
    • Site Builder, Child of Zeus

    Hi,

    Sure it is.

    The simplest way to do this is with php (but i’m sure there are some plugins aswell).

    What you do is to create a shortcode that gets the lists of all your blogs.

    function site_list_func( $atts ){
    $blog_list = get_blog_list( 0, 'all' );

    $output .= '<ul>';
    foreach ($blog_list AS $blog) {
    $output .= '<li> '.$blog['domain'].$blog['path'].'</li>';
    }
    $output .= '</ul>';
    return $output;
    }
    add_shortcode( 'site_list', 'site_list_func' );

    I’ve created a simple shortocde you can use. All you need to do is to copy this to your functions.php somewere. Then you can get the list by writing “[site_list]” in a post or page in wordpress.

    Or if you know PHP and know where to place it you can simply write:

    <ul>
    <?php
    foreach ($blog_list AS $blog): ?>
    <li> <?php $blog['domain'].$blog['path'] ?> </li>
    <?php endif; ?>
    </ul>

    I hope this resolves your problem.

  • Paddy
    • The Bug Hunter

    Hi Jorgen, Hi Joe,

    Thanks for your reply.

    In which functions.php should I create that shortcode.

    I checked my server and have functions.php file for the gridmarket childtheme, the framemarket theme.

    Please see the screenshot.

    Thank you in advance for your explanation.

    ciao

    pat

  • Paddy
    • The Bug Hunter

    Hi guys,

    I have found the following plugin to create shortcode, however this shortcode lists also the blog but I would like to list only the shops and not the blogs.

    “Multi-Site Site List Shortcode”

    Is it possible to differenciate the blogs from the sites?

    thanks.

    Patrizio

  • Jorgen Juel
    • Site Builder, Child of Zeus

    Hi Patrizio,

    Answer to your first question: You need to add the function to the functions.php file in the template your site is using. Then the shortcode will only work on that (or those) site(s) that use the theme. (but it will still gather the details from all the other sites in the same network.

    That plugin is probably doing the same thing, so you’ll get the same result (I think).

    All sites created with wordpress are “blogs”, how are theese “blogs” and “sites” diferrenciated on your configuration?

    Jørgen Juel

  • Jorgen Juel
    • Site Builder, Child of Zeus

    Hi,

    I might be wrong, or I might have mistaken what you mean, but as far my knowlege extends, wordpress is only blogs, but you can ofcourse use it as a “site” (which most of us do, I think).

    But what do you do when you create blogs and what do you do when you create sites? (what do you do differently?).

    What I do is to log in to the network administration dashboard, then i go to sites > add new.

  • aecnu
    • WP Unicorn

    Greetings Pat,

    Thank you for the additional details and I am a bit confused on what you are wanting to do and believe it is a list of shops to choose from and you are using Frame Market/Grid Market?

    If this is indeed the case then while logged into the site admin dashboard go to –> Appearance –> Theme Options –> Show shop picker? and select yes then save options on the bottom left corner.

    Please advise.

    Cheers, Joe

  • Paddy
    • The Bug Hunter

    Hi Joe,

    Thanks for this.

    I want only a list of shops excluding the blogs.

    If I choose the show shop picker is showing also the blog pages…

    Would it be possible to exclude the blogs in an automatic way?

    Please advise.

    Thanks.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.