All WordPress snippets
WordPress

Define a Reusable Global String

A simple pattern for storing a value — like a phone number or address — in one place and reusing it anywhere in your theme.

php
/**
 * Create a global string
 */
function global_string() {
    return 'String';
}

Usage:


echo global_string();

Want your own copy? Fork this repo and build your own snippet collection. Fork on GitHub →