1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How can i get main domain url

Discussion in 'WordPress' started by srobona, May 18, 2011.

  1. #1
    Hello,

    I need a solution for this:

    I have lots of wp blogs installed in sub domains like:

    www . mysite . com /wordpress

    when i use bloginfo( 'url' ), it shows the blog url.

    Is there any way which will output www . mysite . com ?

    I just want to avoid any hard coded values.


    Any suggestion will be very much appreciated.

    Thanks
     
    srobona, May 18, 2011 IP
  2. viruthagiri

    viruthagiri Active Member

    Messages:
    232
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    95
    #2
    Thats because you installed your wordpress in a sub directory. I don't think you can call your main domain without custom function. Read here. http://codex.wordpress.org/Function_Reference/bloginfo

    Create a custom function to echo your main domain.
    Insert those code in your functions.php file. There after you can call maindomain() wherever you need that url. All the best
     
    viruthagiri, May 19, 2011 IP
    srobona likes this.
  3. srobona

    srobona Active Member

    Messages:
    577
    Likes Received:
    57
    Best Answers:
    0
    Trophy Points:
    88
    #3
    Hi viruthagiri, thank a lot for your reply.

    I had read the function reference page, and i had created my own function to do it. And it works good :)
     
    srobona, May 19, 2011 IP
  4. viruthagiri

    viruthagiri Active Member

    Messages:
    232
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    95
    #4
    You are welcome mate...
     
    viruthagiri, May 22, 2011 IP