';
}
add_action( 'wp_head', 'blogun_meta_viewport', 1 );
/**
* Add a pingback url auto-discovery header for singularly identifiable articles.
*
* @since 1.0.0
*/
function blogun_pingback_header() {
if ( is_singular() && pings_open() ) {
printf( '' . "\n", esc_url( get_bloginfo( 'pingback_url' ) ) );
}
}
add_action( 'wp_head', 'blogun_pingback_header' );
/**
* Adds the meta tag for website accent color.
*
* @since 1.0.0
*/
function blogun_meta_theme_color() {
$color = blogun_option( 'accent_color' );
if ( $color ) {
printf( '', esc_attr( $color ) );
}
}
add_action( 'wp_head', 'blogun_meta_theme_color' );
/**
* Outputs the theme top bar area.
*
* @since 1.0.0
*/
function blogun_topbar_output() {
if ( ! blogun_is_top_bar_displayed() ) {
return;
}
get_template_part( 'template-parts/topbar/topbar' );
}
add_action( 'blogun_header', 'blogun_topbar_output', 10 );
/**
* Outputs the top bar widgets.
*
* @since 1.0.0
* @param string $location Widget location in top bar.
*/
function blogun_topbar_widgets_output( $location ) {
do_action( 'blogun_top_bar_widgets_before_' . $location );
$blogun_top_bar_widgets = blogun_option( 'top_bar_widgets' );
if ( is_array( $blogun_top_bar_widgets ) && ! empty( $blogun_top_bar_widgets ) ) {
foreach ( $blogun_top_bar_widgets as $widget ) {
if ( ! isset( $widget['values'] ) ) {
continue;
}
if ( $location !== $widget['values']['location'] ) {
continue;
}
if ( function_exists( 'blogun_top_bar_widget_' . $widget['type'] ) ) {
$classes = array();
$classes[] = 'blogun-topbar-widget__' . esc_attr( $widget['type'] );
$classes[] = 'blogun-topbar-widget';
if ( isset( $widget['values']['visibility'] ) && $widget['values']['visibility'] ) {
$classes[] = 'blogun-' . esc_attr( $widget['values']['visibility'] );
}
$classes = apply_filters( 'blogun_topbar_widget_classes', $classes, $widget );
$classes = trim( implode( ' ', $classes ) );
printf( '
', esc_attr( $classes ) );
call_user_func( 'blogun_top_bar_widget_' . $widget['type'], $widget['values'] );
printf( '
' );
}
}
}
do_action( 'blogun_top_bar_widgets_after_' . $location );
}
add_action( 'blogun_topbar_widgets', 'blogun_topbar_widgets_output' );
/**
* Outputs the theme header area.
*
* @since 1.0.0
*/
function blogun_header_output() {
if ( ! blogun_is_header_displayed() ) {
return;
}
get_template_part( 'template-parts/header/base' );
}
add_action( 'blogun_header', 'blogun_header_output', 20 );
/**
* Outputs the header widgets in Header Widget Locations.
*
* @since 1.0.0
* @param string $locations Widget location.
*/
function blogun_header_widgets( $locations ) {
$locations = (array) $locations;
$all_widgets = (array) blogun_option( 'header_widgets' );
$header_widgets = $all_widgets;
$header_class = '';
if ( ! empty( $locations ) ) {
$header_widgets = array();
foreach ( $locations as $location ) {
$header_class = ' blogun-widget-location-' . $location;
$header_widgets[ $location ] = array();
if ( ! empty( $all_widgets ) ) {
foreach ( $all_widgets as $i => $widget ) {
if ( $location === $widget['values']['location'] ) {
$header_widgets[ $location ][] = $widget;
}
}
}
}
}
echo '';
}
add_action( 'blogun_header_widget_location', 'blogun_header_widgets', 1 );
/**
* Outputs the content of theme header.
*
* @since 1.0.0
*/
function blogun_header_content_output() {
// Get the selected header layout from Customizer.
$header_layout = blogun_option( 'header_layout' );
?>
', esc_attr( $classes ) );
call_user_func( 'blogun_copyright_widget_' . $widget['type'], $widget['values'] );
printf( '' );
}
}
}
do_action( 'blogun_copyright_widgets_after_' . $location );
}
add_action( 'blogun_copyright_widgets', 'blogun_copyright_widgets_output' );
/**
* Outputs the theme sidebar area.
*
* @since 1.0.0
*/
function blogun_sidebar_output() {
if ( blogun_is_sidebar_displayed() ) {
get_sidebar();
}
}
add_action( 'blogun_sidebar', 'blogun_sidebar_output' );
/**
* Outputs the back to top button.
*
* @since 1.0.0
*/
function blogun_back_to_top_output() {
if ( ! blogun_option( 'enable_scroll_top' ) ) {
return;
}
get_template_part( 'template-parts/misc/back-to-top' );
}
add_action( 'blogun_after_page_wrapper', 'blogun_back_to_top_output' );
/**
* Outputs the cursor dot.
*
* @since 1.0.0
*/
function blogun_cursor_dot_output() {
if ( ! blogun_option( 'enable_cursor_dot' ) ) {
return;
}
get_template_part( 'template-parts/misc/cursor-dot' );
}
add_action( 'blogun_after_page_wrapper', 'blogun_cursor_dot_output' );
/**
* Outputs the theme page content.
*
* @since 1.0.0
*/
function blogun_page_header_template() {
do_action( 'blogun_before_page_header' );
if ( blogun_is_page_header_displayed() ) {
if ( is_singular( 'post' ) ) {
get_template_part( 'template-parts/header-page-title-single' );
} else {
get_template_part( 'template-parts/header-page-title' );
}
}
do_action( 'blogun_after_page_header' );
}
add_action( 'blogun_page_header', 'blogun_page_header_template' );
/**
* Outputs the theme hero content.
*
* @since 1.0.0
*/
function blogun_blog_hero() {
if ( ! blogun_is_hero_displayed() ) {
return;
}
// Hero type.
$hero_type = blogun_option( 'hero_type' );
do_action( 'blogun_before_hero' );
// Enqueue Blogun Slider script.
wp_enqueue_script( 'blogun-slider' );
?>
>
>
>
options->get( 'blogun_blog_layout' ) == 'blog-masonry' ? 'masonries' : '';
$blogun_blog_layout_column = 12;
if ( blogun()->options->get( 'blogun_blog_layout' ) != 'blog-horizontal' ) :
$blogun_blog_layout_column = blogun()->options->get( 'blogun_blog_layout_column' );
endif;
if ( have_posts() ) :
echo '';
while ( have_posts() ) :
the_post();
echo '
';
get_template_part( 'template-parts/content/content', blogun_get_article_feed_layout() );
echo '
';
endwhile;
echo '
';
blogun_pagination();
else :
get_template_part( 'template-parts/content/content', 'none' );
endif;
}
add_action( 'blogun_content', 'blogun_content' );
add_action( 'blogun_content_archive', 'blogun_content' );
add_action( 'blogun_content_search', 'blogun_content' );
/**
* Outputs the theme single content.
*
* @since 1.0.0
*/
function blogun_content_singular() {
if ( have_posts() ) :
while ( have_posts() ) :
the_post();
if ( is_singular( 'post' ) ) {
do_action( 'blogun_content_single' );
} else {
do_action( 'blogun_content_page' );
}
endwhile;
else :
get_template_part( 'template-parts/content/content', 'none' );
endif;
}
add_action( 'blogun_content_singular', 'blogun_content_singular' );
/**
* Outputs the theme 404 page content.
*
* @since 1.0.0
*/
function blogun_404_page_content() {
get_template_part( 'template-parts/content/content', '404' );
}
add_action( 'blogun_content_404', 'blogun_404_page_content' );
/**
* Outputs the theme page content.
*
* @since 1.0.0
*/
function blogun_content_page() {
get_template_part( 'template-parts/content/content', 'page' );
}
add_action( 'blogun_content_page', 'blogun_content_page' );
/**
* Outputs the theme single post content.
*
* @since 1.0.0
*/
function blogun_content_single() {
get_template_part( 'template-parts/content/content', 'single' );
}
add_action( 'blogun_content_single', 'blogun_content_single' );
/**
* Outputs the comments template.
*
* @since 1.0.0
*/
function blogun_output_comments() {
comments_template();
}
add_action( 'blogun_after_singular', 'blogun_output_comments' );
/**
* Outputs the theme archive page info.
*
* @since 1.0.0
*/
function blogun_archive_info() {
// Author info.
if ( is_author() ) {
get_template_part( 'template-parts/entry/entry', 'about-author' );
}
}
add_action( 'blogun_before_content', 'blogun_archive_info' );
/**
* Outputs more posts button to author description box.
*
* @since 1.0.0
*/
function blogun_add_author_posts_button() {
if ( ! is_author() ) {
get_template_part( 'template-parts/entry/entry', 'author-posts-button' );
}
}
add_action( 'blogun_entry_after_author_description', 'blogun_add_author_posts_button' );
/**
* Outputs Comments Toggle button.
*
* @since 1.0.0
*/
function blogun_comments_toggle() {
if ( blogun_comments_toggle_displayed() ) {
get_template_part( 'template-parts/entry/entry-show-comments' );
}
}
add_action( 'blogun_before_comments', 'blogun_comments_toggle' );
/**
* Outputs Pre-Footer area.
*
* @since 1.0.0
*/
function blogun_pre_footer() {
if ( ! blogun_is_pre_footer_displayed() ) {
return;
}
get_template_part( 'template-parts/pre-footer/base' );
}
add_action( 'blogun_before_colophon', 'blogun_pre_footer' );
/**
* Outputs Page Preloader.
*
* @since 1.0.0
*/
function blogun_preloader() {
if ( ! blogun_is_preloader_displayed() ) {
return;
}
get_template_part( 'template-parts/preloader/base' );
}
add_action( 'blogun_before_page_wrapper', 'blogun_preloader' );
/**
* Outputs breadcrumbs after header.
*
* @since 1.0.0
* @return void
*/
function blogun_breadcrumb_after_header_output() {
if ( 'below-header' === blogun_option( 'breadcrumbs_position' ) && blogun_has_breadcrumbs() ) {
$alignment = 'blogun-text-align-' . blogun_option( 'breadcrumbs_alignment' );
$args = array(
'container_before' => '',
'container_after' => '
',
);
blogun_breadcrumb( $args );
}
}
add_action( 'blogun_main_start', 'blogun_breadcrumb_after_header_output' );
/**
* Outputs breadcumbs in page header.
*
* @since 1.0.0
* @return void
*/
function blogun_breadcrumb_page_header_output() {
if ( blogun_page_header_has_breadcrumbs() ) {
if ( is_singular( 'post' ) ) {
$args = array(
'container_before' => '',
'container_after' => '
',
);
} else {
$args = array(
'container_before' => '',
'container_after' => '
',
);
}
blogun_breadcrumb( $args );
}
}
add_action( 'blogun_page_header_end', 'blogun_breadcrumb_page_header_output' );
/**
* Replace tranparent header logo.
*
* @since 1.0.0
* @param string $output Current logo markup.
* @return string Update logo markup.
*/
function blogun_transparent_header_logo( $output ) {
// Check if transparent header is displayed.
if ( blogun_is_header_transparent() ) {
// Check if transparent logo is set.
$logo = blogun_option( 'tsp_logo' );
$logo = isset( $logo['background-image-id'] ) ? $logo['background-image-id'] : false;
$retina = blogun_option( 'tsp_logo_retina' );
$retina = isset( $retina['background-image-id'] ) ? $retina['background-image-id'] : false;
if ( $logo ) {
$output = blogun_get_logo_img_output( $logo, $retina, 'blogun-tsp-logo' );
}
}
return $output;
}
add_filter( 'blogun_logo_img_output', 'blogun_transparent_header_logo' );
add_filter( 'blogun_site_title_markup', 'blogun_transparent_header_logo' );
/**
* Output the main navigation template.
*/
function blogun_main_navigation_template() {
get_template_part( 'template-parts/header/navigation' );
}
/**
* Output the Header logo template.
*/
function blogun_header_logo_template() {
get_template_part( 'template-parts/header/logo' );
}
if ( ! function_exists( 'blogun_display_customizer_shortcut' ) ) {
/**
* This function display a shortcut to a customizer control.
*
* @param string $class_name The name of control we want to link this shortcut with.
* @param bool $is_section_toggle Tells function to display eye icon if it's true.
*/
function blogun_display_customizer_shortcut( $class_name, $is_section_toggle = false, $should_return = false ) {
if ( ! is_customize_preview() ) {
return;
}
$icon = '';
if ( $is_section_toggle ) {
$icon = '';
}
$data = '
';
if ( $should_return === true ) {
return $data;
}
echo $data;
}
}
function blogun_about_button() {
$button_widgets = blogun_option( 'about_widgets' );
if ( empty( $button_widgets ) ) {
return;
}
foreach ( $button_widgets as $widget ) {
call_user_func( 'blogun_about_widget_' . $widget['type'], $widget['values'] );
}
}
function blogun_cta_widgets() {
$widgets = blogun_option( 'cta_widgets' );
if ( empty( $widgets ) ) {
return;
}
foreach ( $widgets as $widget ) {
call_user_func( 'blogun_cta_widget_' . $widget['type'], $widget['values'] );
}
}
/**
* Outputs the content of theme Service.
*
* @since 1.0.0
*/
function blogun_service_content_output( $args ) {
$args = (object) $args;
// Get the selected service layout from Customizer.
$services_style = blogun_option( 'services_style' );
// Load service layout template.
get_template_part( 'template-parts/components/service/service-layout', $services_style, $args );
}
add_action( 'blogun_service_content', 'blogun_service_content_output', 10, 1 );
/**
* Outputs the content of theme Info.
*
* @since 1.0.0
*/
function blogun_info_content_output( $args ) {
$args = (object) $args;
// Get the selected info layout from Customizer.
$info_style = blogun_option( 'info_style' );
// Load info layout template.
get_template_part( 'template-parts/components/info/info-layout', $info_style, $args );
}
add_action( 'blogun_info_content', 'blogun_info_content_output', 10, 1 );
/**
* Outputs the content of theme Team.
*
* @since 1.0.0
*/
function blogun_team_content_output( $args ) {
$args = (object) $args;
// Get the selected team layout from Customizer.
$team_style = blogun_option( 'team_style' );
// Load team layout template.
get_template_part( 'template-parts/components/team/team-layout', $team_style, $args );
}
add_action( 'blogun_team_content', 'blogun_team_content_output', 10, 1 );
/**
* Outputs the content of theme Features.
*
* @since 1.0.0
*/
function blogun_features_content_output( $args ) {
$args = (object) $args;
// Get the selected features layout from Customizer.
$features_style = blogun_option( 'features_style' );
// Load features layout template.
get_template_part( 'template-parts/components/features/features-layout', $features_style, $args );
}
add_action( 'blogun_features_content', 'blogun_features_content_output', 10, 1 );