', esc_url( get_bloginfo( 'pingback_url' ) ) );
}
}
add_action( 'wp_head', 'blogloom_pingback_header' );
/**
* Register custom header
*/
function blogloom_custom_header_setup() {
add_theme_support(
'custom-header',
apply_filters(
'blogloom_custom_header_args',
array(
'default-image' => '',
'default-text-color' => '000000',
'width' => 1920,
'height' => 250,
'flex-height' => true,
'wp-head-callback' => 'blogloom_header_style',
)
)
);
}
add_action( 'after_setup_theme', 'blogloom_custom_header_setup' );
/**
* Implement the Custom Header feature.
*/
function blogloom_header() {
$header_layout = get_theme_mod('blogloom_header_layout', 'layout-1');
if ($header_layout == 'layout-1') {
get_template_part('template-parts/header/header', 'layout-1');
} elseif ($header_layout == 'layout-2') {
get_template_part('template-parts/header/header', 'layout-2');
} else {
get_template_part('template-parts/header/header', 'layout-1');
}
}
add_action('blogloom_header', 'blogloom_header');
/**
* Breadcrumb function
*/
function blogloom_breadcrumb() {
if (!is_front_page()) {
echo '
';
echo '
' . esc_html__('Home', 'blogloom') . '';
if (is_category() || is_single()) {
echo ' » ';
if (is_single()) {
$categories = get_the_category();
if (!empty($categories)) {
echo '
' . esc_html($categories[0]->name) . '';
echo ' » ';
}
the_title();
} else {
single_cat_title();
}
} elseif (is_page()) {
echo ' » ';
the_title();
} elseif (is_search()) {
echo ' » ';
echo esc_html__('Search Results for: ', 'blogloom') . get_search_query();
} elseif (is_tag()) {
echo ' » ';
single_tag_title();
} elseif (is_author()) {
echo ' » ';
echo esc_html__('Author Archives: ', 'blogloom');
the_author();
} elseif (is_archive()) {
echo ' » ';
the_archive_title();
}
echo '
';
}
}
add_action('blogloom_breadcrumb', 'blogloom_breadcrumb');
/**
* Post thumb function
*/
function blogloom_post_thumb($class = '') {
if (has_post_thumbnail()) {
echo '';
the_post_thumbnail('large');
echo '
';
}
}
/**
* Register required plugins
*/
function blogloom_register_required_plugins() {
$plugins = array(
array(
'name' => 'Kirki Customizer Framework',
'slug' => 'kirki',
'required' => false,
),
array(
'name' => 'Contact Form 7',
'slug' => 'contact-form-7',
'required' => false,
),
array(
'name' => 'One Click Demo Import',
'slug' => 'one-click-demo-import',
'required' => false,
),
);
if (function_exists('tgmpa')) {
tgmpa($plugins);
}
}
add_action('tgmpa_register', 'blogloom_register_required_plugins');
/**
* Add customizer settings
*/
function blogloom_customize_register($wp_customize) {
// Add theme options panel
$wp_customize->add_panel('blogloom_theme_options', array(
'title' => esc_html__('Theme Options', 'blogloom'),
'priority' => 130,
));
// Header section
$wp_customize->add_section('blogloom_header_options', array(
'title' => esc_html__('Header Options', 'blogloom'),
'panel' => 'blogloom_theme_options',
'priority' => 10,
));
$wp_customize->add_setting('blogloom_header_layout', array(
'default' => 'layout-1',
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control('blogloom_header_layout', array(
'label' => esc_html__('Header Layout', 'blogloom'),
'section' => 'blogloom_header_options',
'type' => 'select',
'choices' => array(
'layout-1' => esc_html__('Layout 1', 'blogloom'),
'layout-2' => esc_html__('Layout 2', 'blogloom'),
),
));
// Blog section
$wp_customize->add_section('blogloom_blog_options', array(
'title' => esc_html__('Blog Options', 'blogloom'),
'panel' => 'blogloom_theme_options',
'priority' => 20,
));
$wp_customize->add_setting('blogloom_archive_layout', array(
'default' => 'right-sidebar',
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control('blogloom_archive_layout', array(
'label' => esc_html__('Archive Layout', 'blogloom'),
'section' => 'blogloom_blog_options',
'type' => 'select',
'choices' => array(
'right-sidebar' => esc_html__('Right Sidebar', 'blogloom'),
'left-sidebar' => esc_html__('Left Sidebar', 'blogloom'),
'no-sidebar' => esc_html__('No Sidebar', 'blogloom'),
),
));
$wp_customize->add_setting('blogloom_archive_post_layout', array(
'default' => 'grid2',
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control('blogloom_archive_post_layout', array(
'label' => esc_html__('Archive Post Layout', 'blogloom'),
'section' => 'blogloom_blog_options',
'type' => 'select',
'choices' => array(
'grid2' => esc_html__('Grid 2 Columns', 'blogloom'),
'masonry2' => esc_html__('Masonry 2 Columns', 'blogloom'),
'standard' => esc_html__('Standard', 'blogloom'),
),
));
// Single post section
$wp_customize->add_section('blogloom_single_options', array(
'title' => esc_html__('Single Post Options', 'blogloom'),
'panel' => 'blogloom_theme_options',
'priority' => 30,
));
$wp_customize->add_setting('blogloom_single_sidebar', array(
'default' => 'right-sidebar',
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control('blogloom_single_sidebar', array(
'label' => esc_html__('Single Post Sidebar', 'blogloom'),
'section' => 'blogloom_single_options',
'type' => 'select',
'choices' => array(
'right-sidebar' => esc_html__('Right Sidebar', 'blogloom'),
'left-sidebar' => esc_html__('Left Sidebar', 'blogloom'),
'no-sidebar' => esc_html__('No Sidebar', 'blogloom'),
),
));
$wp_customize->add_setting('blogloom_single_related_heading', array(
'default' => esc_html__('Related Posts', 'blogloom'),
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control('blogloom_single_related_heading', array(
'label' => esc_html__('Related Posts Heading', 'blogloom'),
'section' => 'blogloom_single_options',
'type' => 'text',
));
// Footer section
$wp_customize->add_section('blogloom_footer_options', array(
'title' => esc_html__('Footer Options', 'blogloom'),
'panel' => 'blogloom_theme_options',
'priority' => 40,
));
$wp_customize->add_setting('blogloom_footer_copyright', array(
'default' => sprintf(esc_html__('© %1$s %2$s. All Rights Reserved.', 'blogloom'), date_i18n('Y'), get_bloginfo('name')),
'sanitize_callback' => 'wp_kses_post',
));
$wp_customize->add_control('blogloom_footer_copyright', array(
'label' => esc_html__('Footer Copyright Text', 'blogloom'),
'section' => 'blogloom_footer_options',
'type' => 'textarea',
));
// Homepage section
$wp_customize->add_section('blogloom_homepage_options', array(
'title' => esc_html__('Homepage Options', 'blogloom'),
'panel' => 'blogloom_theme_options',
'priority' => 50,
));
$wp_customize->add_setting('blogloom_home_title', array(
'default' => esc_html__('Latest Posts', 'blogloom'),
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control('blogloom_home_title', array(
'label' => esc_html__('Homepage Title', 'blogloom'),
'section' => 'blogloom_homepage_options',
'type' => 'text',
));
$wp_customize->add_setting('blogloom_home_description', array(
'default' => '',
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control('blogloom_home_description', array(
'label' => esc_html__('Homepage Description', 'blogloom'),
'section' => 'blogloom_homepage_options',
'type' => 'textarea',
));
}
add_action('customize_register', 'blogloom_customize_register');