', esc_url( get_bloginfo( 'pingback_url' ) ) );
}
}
add_action( 'wp_head', 'bloginwp_pingback_header' );
//define constant
define( 'BLOGINWP_INCLUDES_PATH', get_template_directory() . '/inc/' );
/**
* Enqueue scripts and styles.
*
* @package Bloginwp
* @since 1.0.0
*/
function bloginwp_scripts() {
require_once get_theme_file_path( 'inc/wptt-webfont-loader.php' );
wp_enqueue_style( 'bloginwp-fonts', wptt_get_webfont_url( bloginwp_fonts_url() ), array(), null );
wp_enqueue_style( 'bloginwp-typo-fonts', wptt_get_webfont_url( bloginwp_typo_fonts_url() ), array(), null );
wp_enqueue_style( 'fontawesome', get_template_directory_uri() . '/assets/lib/fontawesome/css/all.min.css', array(), '5.15.3', 'all' );
wp_enqueue_style( 'bloginwp-custom-style', get_template_directory_uri() . '/assets/css/style.css', array(), BLOGINWP_VERSION, 'all' );
wp_enqueue_style( 'bloginwp-custom-bootstrap', get_template_directory_uri() . '/assets/css/custom_bootstrap.css', array(), BLOGINWP_VERSION, 'all' );
wp_enqueue_style( 'slick', get_template_directory_uri() . '/assets/lib/slick/slick.css', array(), '1.8.0', 'all' );
wp_enqueue_style( 'bloginwp-additional-css', get_template_directory_uri() . '/assets/css/additional.css', array(), BLOGINWP_VERSION, 'all' );
wp_enqueue_style( 'bloginwp-additional-style-css', get_template_directory_uri() . '/assets/css/additional-styled.css', array(), BLOGINWP_VERSION, 'all' );
wp_enqueue_style( 'bloginwp-style', get_stylesheet_uri(), array(), BLOGINWP_VERSION );
wp_style_add_data( 'bloginwp-style', 'rtl', 'replace' );
// enqueue inline style
ob_start();
include get_template_directory() . '/inc/inline-styles.php';
$bloginwp_theme_inline_sss = ob_get_clean();
wp_add_inline_style( 'bloginwp-style', wp_strip_all_tags($bloginwp_theme_inline_sss) );
wp_enqueue_script('jquery-masonry');
$sticky_sidebars_option = get_theme_mod( 'sticky_sidebars_option', false );
if( $sticky_sidebars_option ) wp_enqueue_script( 'theia-sticky-sidebar', get_template_directory_uri() . '/assets/lib/sticky/theia-sticky-sidebar.js', array(), '1.7.0', true );
$sticky_header_option = get_theme_mod( 'sticky_header_option', false );
$sticky_header_responsive_display = get_theme_mod( 'sticky_header_responsive_display', false );
if ( ! $sticky_header_responsive_display && wp_is_mobile() ) {
$sticky_header_option = false;
}
$relative_popup = true;
if ( wp_is_mobile() ) $relative_popup = false;
if( $sticky_header_option || $relative_popup ) wp_enqueue_script( 'waypoint', get_template_directory_uri() . '/assets/lib/waypoint/jquery.waypoint.min.js', array(), '4.0.1', true );
wp_enqueue_script( 'imagesloaded', get_template_directory_uri() . '/assets/lib/imagesloaded/imagesloaded.pkgd.min.js', array( 'jquery' ), '4.1.14', true );
wp_enqueue_script( 'slick', get_template_directory_uri() . '/assets/lib/slick/slick.min.js', array( 'jquery' ), '1.8.1', true );
wp_enqueue_script( 'bloginwp-theme', get_template_directory_uri() . '/assets/js/theme.js', array( 'jquery' ), BLOGINWP_VERSION, true );
wp_enqueue_script( 'bloginwp-navigation', get_template_directory_uri() . '/assets/js/navigation.js', array( 'jquery' ), BLOGINWP_VERSION, true );
$scriptVars = array(
'scrollToTop' => get_theme_mod( 'scroll_to_top_option', true ),
'stickySidebar' => esc_html( $sticky_sidebars_option ),
'stickyHeader' => esc_html( $sticky_header_option ),
'relative_post_popup' => esc_html( $relative_popup )
);
if( is_home() || is_archive() || is_search() ) {
global $wp_query;
$scriptVars['currentPage'] = ( is_search() ) ? 'search' : 'archive';
$scriptVars['paged'] = get_query_var('paged');
$scriptVars['_wpnonce'] = wp_create_nonce( 'bloginwp-posts-nonce' );
$scriptVars['ajaxUrl'] = admin_url('admin-ajax.php');
$scriptVars['query_vars'] = $wp_query->query_vars;
}
wp_localize_script( 'bloginwp-theme', 'bloginwpObject', $scriptVars );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'bloginwp_scripts' );
if( !function_exists( 'bloginwp_typo_fonts_url' ) ) :
/**
* Filter and Enqueue typography fonts
*
* @package Bloginwp
* @since 1.0.0
*/
function bloginwp_typo_fonts_url() {
$site_title_font_family = get_theme_mod( 'site_title_font_family', 'Montserrat' );
$site_title_font_weight = get_theme_mod( 'site_title_font_weight', '500' );
$site_title_typo = $site_title_font_family.":".$site_title_font_weight;
$header_menu_font_family = get_theme_mod( 'header_menu_font_family', 'Montserrat' );
$header_menu_font_weight = get_theme_mod( 'header_menu_font_weight', '400' );
$header_menu_typo = $header_menu_font_family.":".$header_menu_font_weight;
$get_fonts = array( $site_title_typo, $header_menu_typo );
$font_weight_array = array();
foreach ( $get_fonts as $fonts ) {
$each_font = explode( ':', $fonts );
if ( ! isset ( $font_weight_array[$each_font[0]] ) ) {
$font_weight_array[$each_font[0]][] = $each_font[1];
} else {
if ( ! in_array( $each_font[1], $font_weight_array[$each_font[0]] ) ) {
$font_weight_array[$each_font[0]][] = $each_font[1];
}
}
}
$final_font_array = array();
foreach ( $font_weight_array as $font => $font_weight ) {
$each_font_string = $font.':'.implode( ',', $font_weight );
$final_font_array[] = $each_font_string;
}
$final_font_string = implode( '|', $final_font_array );
$google_fonts_url = '';
$subsets = 'cyrillic,cyrillic-ext';
if ( $final_font_string ) {
$query_args = array(
'family' => urlencode( $final_font_string ),
'subset' => urlencode( $subsets )
);
$google_fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' );
}
return $google_fonts_url;
}
endif;
/**
* Register Google fonts.
* @return string Google fonts URL for the theme.
*/
if ( ! function_exists( 'bloginwp_fonts_url' ) ) :
function bloginwp_fonts_url() {
$fonts_url = '';
$fonts = array();
$subsets = 'cyrillic,cyrillic-ext';
if ( 'off' !== esc_html_x( 'on', 'Public Sans: on or off', 'bloginwp' ) ) {
$fonts[] = 'Montserrat:ital,wght@0,300;0,400;0,500;0,600;1,400&display=swap';
}
if ( 'off' !== esc_html_x( 'on', 'Heebo: on or off', 'bloginwp' ) ) {
$fonts[] = 'Playfair Display:ital,wght@0,400;0,500;0,600;0,700;1,500&display=swap';
}
if ( $fonts ) {
$fonts_url = add_query_arg( array(
'family' => urlencode( implode( '|', $fonts ) ),
'subset' => urlencode( $subsets ),
), 'https://fonts.googleapis.com/css' );
}
return $fonts_url;
}
endif;
/**
* Include files
*/
require get_template_directory() . '/inc/customizer/customizer.php';
require get_template_directory() . '/inc/hooks/frontpage-sections.php';
require get_template_directory() . '/inc/widgets/widgets.php';
require get_template_directory() . '/inc/hooks/hooks.php';
if( ! function_exists( 'bloginwp_get_thumb_html_by_post_format' ) ) :
/**
* Renders the html content of the current post - w.r.t current post format
*
* @package Bloginwp
* @since 1.0.0
*
* @return html
*/
function bloginwp_get_thumb_html_by_post_format() {
$format = get_post_format() ? : 'standard';
if( $format === 'image' ) return;
switch( $format ) :
case 'video' : // video post format
if( has_block('core/video') || has_block('core/embed') ) :
$blocksArray = parse_blocks( get_the_content() );
foreach( $blocksArray as $singleBlock ) :
//var_dump($singleBlock);
if( 'core/video' === $singleBlock['blockName'] ) { echo wp_kses_post(apply_filters( 'the_content', render_block( $singleBlock ) )); break; }
//if( 'core/embed' === $singleBlock['blockName'] )
endforeach;
else :
?>
';
echo '