You can put you code in functions.php where you define the string, for example:
<?php
function get_banner_text() {
$url = $_SERVER["REQUEST_URI"];
if (strpos($url, "bob.")) {
$banner_text = "Welcome to Agent Bob's Portal!";
} else {
$banner_text = "Default text here";
}
return $banner_text;
}
?>
Afterwards for example in header.php of your theme you could have like:
<div class="banner"><?php echo get_banner_text(); ?></div>
Related Posts:
- Function to return true if current page has child pages
- Cleaning up WordPress to improve performance?
- Include a external PHP file into a WordPress Custom Template
- List of all theme customizer control types?
- Show the most popular post per week
- Add a class to links in the visual editor (how to get old dialog back)
- Creating custom Woocommerce attribute taxonomies from a plugin
- Remove/unset options field from backend Settings->General?
- Display posts by month
- How to preserve PHP modifications while upgrading WordPress?
- Removing jQuery migrate and working with dependencies
- Load post content into iframe
- is there a simple way to list every templates / php files used to generate a specific page?
- wp_customize_image_control default value
- How To Customize Position of »add to cart« of WooCommerce on Product Page [closed]
- Authenticating to WordPress, using my own authentication two-factor system
- Overriding a theme redux file in child theme
- there’s a way to include a minimal WP for check only the current user, its roles (caps?) and then release/free it?
- Widgets not showing in my custom theme
- How to create Sub Sub domain Multi User blogs?
- How to display custom field on homepage
- How to display something in a div when the user clicks on a text in another div – no page refresh [closed]
- How to get 2 or multiple custom post types in wordpress functions.php
- Creating bulk posts with Youtube videos
- Trouble creating conditional PHP for nav menu items with children for custom Walker
- Setting custom canonical urls
- Only show search results with if current date is between two dates?
- database interactions using OOP
- create a select input with menus created on a custom options page
- WordPress blog post url on category page
- Extending the WP_Widget_Text class
- Retrieve $_POST data submitted from external URL in WordPress(NOT API)
- Trying to build simple deposit code that hooks into woocommerce
- user_profile_update_errors hook not executing
- Saving and Restoring a Canvas on A Individual User Basis
- Extend plugin Class through functions.php
- How to add a do_action on refreshing of WP customizer?
- Customize position of social icons in upme plugin [closed]
- Weird 404 URL Problem – domain name being placed at end of urls
- Output custom field value to post string
- Compare the old get_theme_mod($name) to the new get_theme_mod($name) return value
- Media Upload , file name changed automatically
- need help with existing code showing subpages
- How do I add a custom css to all posts without affecting homepage css? [closed]
- how to show only specific category for a template
- Advanced Custom Fields not displaying
- How to get private property in parent class into extended class?
- Exclude posts with specific metadata from search?
- Warning: Illegal string offset on theme options page [closed]
- Clickable image link sends people to wrong URL
- Different Subdomain changes page content
- How to include custom PHP file both in header and footer files
- Check class_exists before class definition / Doxygen problem
- Extract links from content
- Integrating Yii2 and WordPress
- Custom Registration username_exists / email_exists
- Automatically generator a WordPress installation on my subdomain
- After disabling WPML multi currency, the currency is still handled by the WPML
- get_theme_mod outputs number when using WP_Customize_Cropped_Image_Control
- PHP Helper Class to create shortcodes
- Reusable code that I can store in the function.php and apply to other templates as need. Dry Code
- Is it possible to add a custom page to a free WordPress site? [closed]
- Is there a hack for using is_page() within the function.php file?
- How to Fix an Archive.php That Displays All Posts?
- Assign Custom classes to every Excerpt
- Make next post button link to random post
- Site DOES NOT LOAD after 3.1 update
- How to make Subdomain work for product_tag?
- Customizer control save then return to default
- WP-Bakery – Add custom colors to buttons with template colors
- How to serve WordPress folder over subdomain?
- update_user_meta as multiple value but with same meta key
- retrieve “Link Color” value
- Delete post meta by serialized meta value
- How to add a full working piece of website already coded, to a large scale Website design project?
- Redirecting the lost password page request when using a custon login page
- Create custom admin page with custom text fields
- Remove specific javascript when viewing page in Customizer?
- Running local copy of an old WordPress site on MAMP
- Customizing WooCommerce with PHP
- Multisite – Display different header content based on which site is accessed
- What image is this pulling?
- How can I customize a WordPress theme before it’s downloaded?
- What is the best practice for restricting a section to logged in users?
- PHP call div with function
- How to use PHP code with wordpress page
- if is_bbPress register jquery
- Auto create description in post
- error with WP custom form
- WordPress causing all code to be displayed on line 1. Receiving multiple errors after cleaning cookies and cache
- How can I clear the theme mod settings?
- Custom PHP-coding in MU installs
- Date when the custom field was added
- HTML in PHP problem [closed]
- WP Custom tables query
- Add multiple HTML attributes to an Elementor button
- Woocomerce custom add to cart button edit functionality [closed]
- fetch from an external api call and display results in page
- Duplicated WP Multisite for testing environment is redirecting to production site
- Access wordpress blog on subdirectory /blog that is running on subdomain