The MU forums have moved to WordPress.org

Adding Blog ID to Code (5 posts)

  1. fai714
    Member
    Posted 14 years ago #

    We have a code that matches the blog id of a site to an external site.In the following code, where it says 558 we need to place something that will grab the current blog's ID number. Putting the ids in manually work properly but would like it to grab it automatcially. Any idea how to do this? Thanks!

    a href="http://www.mysite.com/redirector.aspx?utm_source=sp&utm_campaign=partner&utm_medium=banner&utm_content=utm_term=&partnersiteid=558&" ><img src="http://www.mysite.com/banner.aspx?v=4&bannername=SchoolStore2_300x250&partnersiteid=558&system=sp"

  2. ancawonka
    Member
    Posted 14 years ago #

    You can get the blog ID from the $wbpd object, like so:

    <?php
    global $wpdb;
    $current_blog = $wpdb->blogid;
    ?>

  3. skcsknathan001
    Member
    Posted 14 years ago #

    or could simple use

    global $blog_id;

  4. fai714
    Member
    Posted 14 years ago #

    Thank you, worked perfectly, how would I do it for the title of the blog?

  5. ancawonka
    Member
    Posted 14 years ago #

About this Topic

  • Started 14 years ago by fai714
  • Latest reply from ancawonka