/** * Template tag for breadcrumbs. * * @param string $before What to show before the breadcrumb. * @param string $after What to show after the breadcrumb. * @param bool $display Whether to display the breadcrumb (true) or return it (false). * * @return string */ function yoast_breadcrumb($before = '', $after = '', $display = true) { $breadcrumbs_enabled = current_theme_supports('yoast-seo-breadcrumbs'); if (!$breadcrumbs_enabled) { $options = get_option('YMBESEO_internallinks'); $breadcrumbs_enabled = $options['breadcrumbs-enable'] === true; } if ($breadcrumbs_enabled) { return YMBESEO_Breadcrumbs::breadcrumb($before, $after, $display); } }
/** * Get breadcrumb string using the singleton instance of this class * * @param string $before * @param string $after * @param bool $display Echo or return. * * @return object */ public static function breadcrumb($before = '', $after = '', $display = true) { if (!self::$instance instanceof self) { self::$instance = new self(); } // Remember the last used before/after for use in case the object goes __toString(). self::$before = $before; self::$after = $after; $output = $before . self::$instance->output . $after; if ($display === true) { echo $output; return true; } else { return $output; } }