0) {
$html = str_replace('rel="attachment wp-att-'.$id.'"', '', $html);
}
return $html;
}// bootstrapBasicImageSendToEditor
}
add_filter('image_send_to_editor', 'bootstrapBasicImageSendToEditor', 10, 2);
if (!function_exists('bootstrapBasicLinkPagesLink')) {
/**
* replace pagination in posts/pages content to support bootstrap pagination class.
*
* @param string $link
* @param integer $i
* @return string
*/
function bootstrapBasicLinkPagesLink($link, $i)
{
if (!is_scalar($link)) {
$link = '';
}
if (strpos($link, '' . $link . '';
} else {
return '
' . $link . '';
}
}// bootstrapBasicLinkPagesLink
}
add_filter('wp_link_pages_link', 'bootstrapBasicLinkPagesLink', 10, 2);
if (!function_exists('bootstrapBasicNavMenuCssClass')) {
/**
* Add custom class to nav menu
* @param array $classes
* @param object $menu_item
* @return array
*/
function bootstrapBasicNavMenuCssClass($classes = array(), $menu_item = false)
{
if (!is_array($menu_item->classes)) {
return $classes;
}
if (in_array('current-menu-item', $menu_item->classes)) {
$classes[] = 'active';
}
if (in_array('menu-item-has-children', $menu_item->classes)) {
$classes[] = 'dropdown';
}
if (in_array('sub-menu', $menu_item->classes)) {
$classes[] = 'dropdown-menu';
}
return $classes;
}// bootstrapBasicNavMenuCssClass
}
add_filter('nav_menu_css_class', 'bootstrapBasicNavMenuCssClass', 10, 2);
if (!function_exists('bootstrapBasicWpTitle')) {
/**
* Filters wp_title to print a neat tag based on what is being viewed.
*
* copy from underscore theme.
*
* @link https://developer.wordpress.org/reference/functions/wp_title/ Document.
* @link https://make.wordpress.org/core/2015/10/20/document-title-in-4-4/ wp_title was deprecated.
* @link https://core.trac.wordpress.org/changeset/35624 wp_title now un-deprecated.
*/
function bootstrapBasicWpTitle($title, $sep)
{
global $page, $paged;
if (is_feed()) {
return $title;
}
// Add the blog name
$title .= get_bloginfo('name');
// Add the blog description for the home/front page.
$site_description = get_bloginfo('description', 'display');
if ($site_description && (is_home() || is_front_page())) {
$title .= " $sep $site_description";
}
// Add a page number if necessary:
if ($paged >= 2 || $page >= 2) {
/* translators: %s: Page number. */
$title .= " $sep " . sprintf(__('Page %s', 'bootstrap-basic'), max($paged, $page));
}
return $title;
}// bootstrapBasicWpTitle
}
add_filter('wp_title', 'bootstrapBasicWpTitle', 10, 2);
if (!function_exists('bootstrapBasicWpTitleSeparator')) {
/**
* Replace title separator from its original (-) to the new one (|).
* The old function `wp_title` has been deprecated. For more info please read at the link below
*
* @link https://developer.wordpress.org/reference/hooks/document_title_separator/ Document.
*/
function bootstrapBasicWpTitleSeparator($sep)
{
return '|';
}// bootstrapBasicWpTitleSeparator
}
add_filter('document_title_separator', 'bootstrapBasicWpTitleSeparator', 10, 1);