1

I'd like to do this when clicking on home icon :

  • if we are not on the homepage of a sub-blog, go to the homepage of the sub-blog
  • if we are on the homepage of a sub-blog, go to the homepage of the whole site

I'm beginner and don't know how to detect the context of homepage for a wordpress mu sub-blog, any idea, thanks ?

1

You could test using the following conditionals

//if you aren't on the main site, and aren't on the homepage
if (!is_main_site() && (!is_front_page() && !is_home())) {
  print "<a href='sub-blog-homepage'>home</a>";
}
//if you aren't on the main site, and aren on the homepage
if (!is_main_site() && (is_front_page() && is_home())) {
  print "<a href='main-site-homepage'>home</a>";
}

Also depending on how your sub-blog homepage is configured, you could use either is_front_page(), is_home().

  • Thanks guy for the code will try it as soon as possible :) – user310291 Sep 7 '16 at 22:07
  • My pleasure! :) – MediaFormat Sep 8 '16 at 13:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.