Safe String Title Settings
-
The IB settings page has some default or “safe” titles listed. The explanation states, “Specify breadcrumb titles for the following pages. Defaults only apply if the page itself does not have a better name.” This makes it sound like the specified titles will only be used if IB can’t find a real title for the page or post on its own. However, in my experience it seems that the “safe” titles are used in every case no matter what.
Specifically, I have a site using Polylang for localization, so the home title may be in English or may be in Chinese depending on which language is selected. However, no matter what language mode I’m in, the “safe” title is always displayed for home. If I type Foo in the Home title setting, then Foo is displayed at the beginning of the breadcrumb chain for all secondary pages. How can I get IB to first try to get the proper title of the home page before resorting to using the “safe” default?
A quick look at the code shows:
1. class-ib-generator.php line 54 gets the text of the home link by calling IB_Options::safe_string(‘front’)
2. the static function safe_string in class-ib-options.php never tries to get a page/post title. It simply grabs the title from the setting, or falls back to a hard-coded default if that setting was null or blank.This may not be the right way to fix the problem, but here’s what I did: (edit of class-ib-generator.php line 54, adding 3 new lines)
$homeTitle = get_the_title(get_option('page_on_front')); if( empty($homeTitle) ) $homeTitle = IB_Options::safe_string( 'front' ); $currentUrl = home_url( add_query_arg( array(), $wp->request ) ); $crumbs = array( array( 'url' => home_url(), 'text' => $homeTitle, 'xclass' => array( 'menu-item-home' ) ) );
Am I not understanding this feature? Is IB not supposed to ever look for the real page title for the home/front page? Thanks in advance for any assistance.
- The topic ‘Safe String Title Settings’ is closed to new replies.