bdonaghy
Expert
Just Getting Started
Member Likes (0)
We have a code that matches the blog id of a site to an external site (store).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 works properly but we would like it to grab it automatically. Any idea how to do this? Thanks!
a href="http://www.mysite.tld/redirector.aspx?utm_source=sp&utm_campaign=partner&utm_medium=banner&utm_content=utm_term=&partnersiteid=558&" ><img src="http://www.mysite.tld/banner.aspx?v=4&bannername=SchoolStore2_300x250&partnersiteid=558&system=sp"

Responses (4)
Keeper of the Dark Chocolate (joined July 2007) Likes (0)
Depends on how you're creating the code as well as if this code would be within a mu environment or a third party site. Can you explain what specifically you;re doing here and/or post the code somewhere like pastebin please?
What you want is $blog_id but how you call it depends on usage.
Member (joined December 2009) Likes (0)
Thanks for the response drmike. We are working with a third party site that has created a store for our sites. Each of those stores have ids that match the ids of our blogs. They created that code which links to each blog's store (off site, third party). That one code will be placed on all of our sites. We need the code to change accordingly.
Heres the code...
Where it says 558 is where the id must change
Thanks
Keeper of the Dark Chocolate (joined July 2007) Likes (0)
I understand that but really need the code that creates the link you give in your paste bin and the environment where that link is going to come from. Will this link be within wpmu or the third party software?
Lead Developer (joined May 2009) Likes (0)
In a plugin or theme you can get the blog_id in different ways. Some examples:
global $blog_id;echo $blog_id;
global $wpdb;
echo $wpdb->blogid;
global $current_blog;echo $current_blog->id;
Become a member