I would stay stick to the function. PHP caches functions for speed and efficiency. In some situations, using a function is faster then using a variable.
There are other benefits too – imagine if you changed the name of your variable – you would have to go and update every piece of code where it’s used.
Related Posts:
- Create a variable with string, array or multiple values
- Best way to access variables in template markup
- What’s the difference between home.php and index.php?
- Custom single template for a specific category
- How to move page template files like page-{slug}.php to a sub-directory?
- What WP folder can I use to write files to?
- How to move page templates to custom folder?
- get_stylesheet_directory() returns wrong URI… localhost/using vhosts
- Is it possible to manipulate the list of page templates?
- Different wordpress 404 template for different post type [duplicate]
- How does WordPress decide what template to use as frontpage
- How can I get wp_head() as a string instead of echoing it?
- Why does my short code get executed before other content?
- How can I see what template parts are being called for rendering the viewable page?
- Add a preview to a WordPress Control Panel
- Add a #hash to the links in my custom menu
- How to load different CSS in different Header?
- Returning Variables back into a template
- How to override BuddyPress 3.0 bp-nouveau theme files?
- Move my theme style.css into a folder
- Passing variables to template parts
- How should I store global information such as a phone number so that it is editable through the CMS?
- When developing a distributable Theme, does it HAVE to be “inheritable”?
- Setting hero/splash section as a blog post
- Where is the correct place(s) in twentysixteen’s header.php to add a Google webfont?
- Add a theme via symlink
- Any tag pagination page (except the 1st page) loads index.php template instead of tag.php
- Loading files for theme and child theme (Require)
- New template, where to place CSS?
- get_query_var() and permalinks
- Toggle Sidebar Display
- Move theme templates to subfolder without losing page associations
- Theme development question regarding layouts
- Why are theme templates organized as multiple point of entry PHP files instead of reusing your theme’s index.php?
- WordPress page templates in a directory
- WordPress Theme Development: How to redirect templates the right way?
- Disable front-page.php template
- Change the template of multiple multisite pages at the same time
- create-guten-block in wordpress theme?
- Override template file i subfolders
- Single Page theme [closed]
- Single page site with history.js
- Do i need to keep all the default WP templates files in a theme?
- How can I detect hierarchal relationships beyond children (grandchild, great-grandchild, etc)?
- how to display search term in the template full site editor
- How to override p2 breathe theme plugin in content template file?
- Move default page templates to sub directory
- Is it possible to make *.js and folders visible in theme-editor
- Where to place template files?
- Is there any tool to find lines of codes responsible to generate front-end HTML elements?
- How do I get the trackback count of a post in wordpress without writing an SQL query?
- Load sidebar template just once to prevent multiple animations
- Replace single_template filter with what for default posts?
- Need help with adding templates (archives and sitemap) to WordPress child theme
- Template for landing pages
- How to unset a set query variable?
- Unique design inside a specific category’s url
- How to seperate static phrases from template files in custom theme?
- Broken theme, template is missing
- How to add menù section to my WordPress template?
- Post and page content not displaying in search results
- where is real values of variables?
- Why still output /wp-content/themes/twentynineteen?
- How to add custom meta box when you have a custom page template file
- Password protect a custom template
- Templates dropdown not appearing using _s theme (underscores)
- Shortcode call not working in WP Template
- How do I include a partial from a directory below a wordpress theme directory?
- Create theme for mobile phones and tablets only?
- I need to develop a one-page design
- add jquery file if a certain page is included
- How to create a WP theme that use BootStrap? [closed]
- index.php file in wp-content/themes/ folder
- Under theme folder, what’s sequence of action for index.php, page.php, single.php?
- Is there a template tag I can use to link to the archive page corresponding to the month that a post was published on?
- get main URL from subdirectory with php
- How to Modify WP_Includes/blocks/latest_posts.php
- How to implement pagination in category.php template
- Local variable name in setup_postdata()
- Template for front page (latest posts)
- Using wp_add_inline_style Inside a Template File
- which template should I use for single category post?
- Should I use template files or just use conditional tags in index.php?
- Different templates for each category level
- Child theme in separate WordPress Install
- How to show children pages as array
- Display content on Single page
- Using require_once for parent-directory not working but is working in sub-directories
- How can I fix the even/odd child classes comments so that the comments are unaffected by the top-level even/odd?
- Current URL path variable
- How Does One Create a Global Variable Repository
- Problem with multiple menus in theme
- Enable WP to accept standard jQuery code embeding between the tags [duplicate]
- Make theme editor to show all theme’s files
- What is the advantage of using home.php over index.php for the front page
- How customizable is a self-hosted WordPress blog compared to a Blogger blog?
- What is the point of using the front-page.php template? [closed]
- What is the point of using archive.php instead of index.php?
- Theme template file for a specific custom taxonomy
- How can one use variables in a template or template part without polluting the global scope?