You can use get_blog_details()
to do it.
Use it the following way:–
function greeting() {
global $blog_id;
$current_blog = get_blog_details( $blog_id );
if ( 'one' == $current_blog->blogname ) {
echo 'hello';
} elseif ( 'two' == $current_blog->blogname ) {
echo 'goodbye';
}
}
Related Posts:
- Prevent “main” WPMU site_url() being returned in functions
- Implementing DNS Prefetching with WordPress
- Different functions file for each site in multisite installation?
- Delete pages and Create default pages for all new network sites
- Multisite, either change the name of sample-page or create new page
- Loop (iterate) through Multi-Site sub-sites (blogs)?
- Global functions on WPMU
- restore_current_blog required after switch_to_blog, if I use that in a function?
- Run function when WordPress new multisite is created or ACF field is updated
- Conditional Gravity Forms filter in WordPress Multisite
- Multisite Ajax serialize return error [object Object]
- Creating new blog on multisite programatically without hacks?
- How to get correct URLs in network wide menu (Multisite)?
- Multisite 404 on pages – rewrite error breaks database
- Has is_archived() for sites in a multisite changed with WP 4.7?
- Function that outputs second theme url
- dynamic site link for future migration in echo do_shortcode()
- wp_get_attachment_image_src returns image on main domain, false on subdomain
- Dashboard blocker on network multisite for specific user roles
- Members only function, but allow account activation [solved]
- Competing Login Redirects – Need to be Combined?
- Adding a class to the body of an inactive site using multisite
- Run function from parent on child site
- Ads Only at one website inside multisite network – code error
- Different ads on every website on multisite environment
- Ajax call always returns 0
- plugins_url vs plugin_dir_url
- Where and how to put inline js in pages
- Is it possible to remove the “standard” post format?
- Hourly Routine Not Firing ( wp_schedule_event() )
- Warning/Notice about functions.php
- How to assign user a role if none is present when logging in
- Is checking whether the blog is installed necessary?
- echo or print_r in an admin function
- Overriding methods in a child theme
- WP disobeys disabling of the posts revision feature
- How do I deactivate a plugin for some roles
- How to display more audio file ID3 tags in WordPress
- Running CRON on Server with WP Function
- Using separate .php file for functions – how to run on site?
- wp_trash_post function to only apply to posts, not pages!
- Adding widget to dashboard with wp_dashboard_setup not working
- Access Plugin data from Functions.php
- Register and load scripts
- Having a Function Inside of the Loop
- how to call a function only in specific pages and exclude it from other pages
- About cron delete user with meta_key
- Add dynamic links in WordPress custom theme
- Unable to login using username
- How to change the order of Jquery in the footer of my theme?
- Attempt to change jQuery version caused White Screen of Death
- media resize/crop possibilities?
- adding custom script to functions file
- edit formatting.php in a theme so it wont get overwritten
- Hook into a function without a hook?
- add_action template_redirect not working for home page
- Way to store featured image width and height in two separate variables?
- Insert template-part inside the content
- Filter yoast canonical add_action priority [closed]
- Add unique id to Preview URL
- Numbering lines of code with the tag?
- Latest Foursquare Checkin function
- PHP 7.1 | Warning: A non-numeric value encountered in
- Way to redirect all Product Sub Category to its Main category Page?
- Fatal error: Call to undefined function is_even()
- How to use parent theme functions in child theme functions.php file?
- How Can I add a menu to the theme from withen the function.php file
- define css class in functions.php
- Adding tables to the WordPress Editor
- Add Login and logout buttons to top menu bar
- implementing a centralized content “show-do-not-show” toggle?
- WordPress – using sessions?
- How to hide content on mobile in the functions.php file – woocommerce
- Load templates, pass arguments, and render output from functions.php
- WordPress Lite/Light
- How to add HTML into error message
- Selecting specific query for offset
- Is_Page doesnt detect my page
- Security when outputing wp_oembed_get code
- Show image after X para – center aligned
- Problems adding a new field to product in cart
- Function for Sticky Post on Categories causes issues with 404 behavior
- function replace_text for entire page
- Get value of pre-populated Gravity forms field as variable in my function
- Will dequeueing in child theme functions.php file prevent Google Fonts from loading?
- What to do to have access to WordPress functions
- Changing the color of post title [closed]
- Create html from function
- wp_list_pages change of children and anchor of parent
- Admin Panel errors because of functions.php
- WordPress not performing direct update
- Using Output from one Function and calling it into another
- How to add a class and title attribute to the link generated by next/previous post
- “Headers already sent” while trying to add a CSS file to my login page?
- Remove theme, change theme button and WP version on “Right Now” admin dashboard?
- Notice: Use of undefined constant REQUEST_URI – assumed ‘REQUEST_URI’ in ….functions.php on line 73
- How do i set global variable in a function in wordpress functions.php
- Working function() doesn’t execute when triggered by WP CRON
- WordPress – Notice: Function wp_enqueue_script was called incorrectly
- post_row_actions filter from parent theme not executing in child theme