How can the $blog_id be used to determine an "echo" statement?
-
Need to know details:
- Hosted on LEMP Stack (Engine X or NGINX – NOT Apache) with Easy Engine (by rtCamp)
- Fresh install of WordPress Multisite (4.1.1) using Sub-directories.
- Genesis Theming Framework & Enterprise Pro Child Theme.
- 10 Sites using the exact same child theme, layout & widgets.
Full disclosure: I may be able to write HTML/HTML5 & CSS/CSS3 from memory, but I do NOT claim to be a PHP expert. So I’m sure the problem lies in the PHP. I can get around and I’m not a complete idiot, but definitely NOT a PHP expert.
I’m trying to create a plugin that displays a single sentence of text, based on which “$blog_id” is currently being viewed by the end user. I’m presently testing this plugin by putting the code directly in the functions.php file.
Here is what I have:
global $blog_id; function phone_number_function() { if( $blog_id == 1 ): echo "Call now (###) ###-###1</a></strong>"; elseif( $blog_id == 2 ): echo "Call now (###) ###-###2</a></strong>"; elseif( $blog_id == 3 ): echo "Call now (###) ###-###3</a></strong>"; // and so on, all the way up to 10 else: echo "Call Toll-Free (800) ###-####</a></strong>";</a></strong>"; endif; }
The first “if” statement shows on all pages. What am I missing?
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘How can the $blog_id be used to determine an "echo" statement?’ is closed to new replies.