Updating old PHP for WP Title Tag
-
Upgrading an old WordPress 3.7.17 site template and there is some questionable code that I’m not clear on entirely and wondering if someone can make a bit more sense of it and help to simplify it for 4.7.1?
<title><?php // Print the <title> tag based on what is being viewed. global $page, $paged; // Add the blog name. bloginfo( 'name' ); if ( is_page() && $post->post_parent && !is_home()) { if (!is_front_page()) { if ($urlSplits[2] != '' && $urlSplits[3] != '') { $grandparent_get = get_post($post->post_parent); $grandparent = $grandparent_get->post_parent; echo ' | ' . get_the_title($grandparent) . ' › '; } else { echo ' | '; } echo get_the_title($post->post_parent) . ' › '; } the_title(); } else { if (is_home()) { the_title(); } else if (!is_front_page() && !is_home() && !is_404()) { echo ' | '; the_title(); } else if (is_404()) { echo ' | Page Not Found'; } } // Add the blog description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) echo " | $site_description"; ?></title>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Updating old PHP for WP Title Tag’ is closed to new replies.