The MU forums have moved to WordPress.org

how to link to a specific blog with its id? (5 posts)

  1. sepp88
    Member
    Posted 15 years ago #

    hi there,

    <a href="<?php get_option('index.php') ?>/soccer"><img class="pikto" src="<?php bloginfo('template_url') ?>/images/soccer_pos.png"/></a>

    how can i change this link to a dynamic one. i don't want to "hardcode" it by adding /soccer to it. Instead i want to call its path by its blogid.

    Something like...

    <a href="<?php get_option('index.php') . get_blogpath_by_id(3) ?>"><img class="pikto" src="<?php bloginfo('template_url') ?>/images/soccer_pos.png"/></a>

    However i have no idea what the actual code looks like. Of course get_blogpath_by_id(3) is Pseudocode!

    ??? thank you for your help

  2. dsader
    Member
    Posted 15 years ago #

    All the usual Template Tags will work the same in WPMU as they do in WP. get_settings('home') appears to be the popular tag to use to get, err, home. ie while visiting blog 3, home will be the url to blog 3.

    <a href="<?php echo get_settings('home'); ?>"><img class="pikto" src="<?php bloginfo('template_url') ?>/images/soccer_pos.png"/></a>

  3. sepp88
    Member
    Posted 14 years ago #

    I know most of the template tags, however in my case get_settings('home') is not the right one, because i'm using this for a sidebar to kind of LIST ALL BLOGS. (i know there is MU-Plugin for that, but i don't want to actually list them as a list, but to list them with specific icons that refer to all my subblogs.)

    So just imagine a sidebar widget with like 10 different icons...I want every icon to list to a specific subblog of my complete MU-setup.

    And that's what i mean by:
    <a href="<?php get_option('index.php') . get_blogpath_by_id(3) ?>"><img class="pikto" src="<?php bloginfo('template_url') ?>/images/soccer_pos.png"/></a>

    I don't want to hardcode every icon by adding:

    <a href="<?php get_option('index.php')?>/newyorkblog"><img class="
    <a href="<?php get_option('index.php')?>/losangelesblog"><img class="
    <a href="<?php get_option('index.php')?>/bostonblog"><img class="
    <a href="<?php get_option('index.php')?>/sanfranciscoblog"><img class="
    etc.

    So i simply want to get the blogpath by queriing it with its ID.
    My Pseudocode to visualize what i mean would look like this:

    <a href="<?php get_option('index.php') . get_blogpath_by_id(3) ?>">

  4. dsader
    Member
    Posted 14 years ago #

    echo get_blogaddress_by_id(3);

    Look in wp-includes/wpmu-functions.php for other WPMU specific morsels.

    I don't know what you expect from "get_option('index.php')"

  5. sepp88
    Member
    Posted 14 years ago #

    thank you!

About this Topic