ElasticDog
Member
Posted 6 years ago #
I recently upgraded from 1.2.1 to 1.5.1.3, and am trying to redesign my site using the theme engine. Anyway, I want to cut down on as many queries and php calls as possible for speed purposes, and wondered if it would be faster to do something like:
<?php if ($_SERVER["REQUEST_URI"] == '/') { echo " | your tagline here"; } ?>
versus using the default template tag is_home to get the same results?
Joshua Sigar
Member
Posted 6 years ago #
global $wp_query->is_home is set automatically when a page is loaded; if you use it, it won't add an extra (sql) query.
Regarding to the speed, is_home() is a function while your code is inline code. Inline code is variably faster than a function call. But then your code is calling a server's variable while is_home is already in memory. That may affect the speed ratio between them. And after all, everything I say is wrong until proven otherwise.