'; } } add_action( 'wp_head', 'bastet_pingback_header' ); /** * Reset api to get author data */ function bastet_add_author_to_json() { register_rest_field( 'post', 'author_data', array( 'get_callback' => 'bastet_get_author_data', 'update_callback' => null, 'schema' => null, ) ); } add_action( 'rest_api_init', 'bastet_add_author_to_json' ); /** * Reset api to get thumbnail src */ function bastet_add_thumbnail_to_json() { register_rest_field( 'post', 'featured_image_src', array( 'get_callback' => 'bastet_get_image_src', 'update_callback' => null, 'schema' => null, ) ); } add_action( 'rest_api_init', 'bastet_add_thumbnail_to_json' ); /** * Ajax function to get posts by query args */ function bastet_ajax_featch_posts() { global $post; if ( ! wp_verify_nonce( filter_input( INPUT_POST, 'nonce' ), 'bastet-nonce' ) ) { wp_die(); } parse_str( filter_input( INPUT_POST, 'query' ), $query_args ); parse_str( filter_input( INPUT_POST, 'meta' ), $meta_args ); set_query_var( 'bastet_mods', $meta_args ); $page = filter_input( INPUT_POST, 'current' ); $query_args['paged'] = (int) $page + 1; $posts = get_posts( $query_args ); if ( 'card' === $meta_args['layout'] ) { $layout = ''; } else { $layout = $meta_args['layout']; } foreach ( $posts as $post ) : // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited setup_postdata( $post ); ob_start(); get_template_part( 'template-parts/content', $layout ); echo ob_get_clean(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped endforeach; set_query_var( 'bastet_mods', false ); wp_reset_postdata(); wp_die(); } add_action( 'wp_ajax_bastet_load_more_posts', 'bastet_ajax_featch_posts' ); add_action( 'wp_ajax_nopriv_bastet_load_more_posts', 'bastet_ajax_featch_posts' ); /** * Append top header template if enabled */ function bastet_add_top_header() { if ( get_theme_mod( 'top_header', false ) ) : get_template_part( 'template-parts/header/top', 'header' ); endif; } add_action( 'bastet_before_header_logo', 'bastet_add_top_header', 12 ); /** * Append header top canvas menu if current style support it */ function bastet_header_left_menu() { $style = get_theme_mod( 'header_style', 'light' ); if ( 'light' !== $style && 'transparent' !== $style && 'large' !== $style ) : printf( '
', bastet_get_svg_icon( 'menu' ) // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ); endif; } add_action( 'bastet_before_site_brand', 'bastet_header_left_menu', 12 ); /** * Append header menu for large style */ function bastet_large_header_menu() { $style = get_theme_mod( 'header_style', 'light' ); if ( 'large' === $style ) : $social_icons = get_theme_mod( 'header_social_icons', array() ); printf( '
', bastet_get_main_nav( 'menu' ) // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ); endif; } add_action( 'bastet_before_header_logo', 'bastet_large_header_menu' ); /** * Append header menu for light and transparent styles */ function bastet_header_right_menu() { $style = get_theme_mod( 'header_style', 'light' ); if ( 'light' === $style || 'transparent' === $style ) : printf( '
', bastet_get_main_nav( 'menu' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped endif; } add_action( 'bastet_after_site_brand', 'bastet_header_right_menu', 12 ); /** * Append header social icons if enabled */ function bastet_header_social() { if ( get_theme_mod( 'header_social', false ) && get_theme_mod( 'header_style', 'light' ) !== 'large' && ! get_theme_mod( 'top_header', false ) ) : $social_icons = get_theme_mod( 'header_social_icons', array() ); bastet_social_icons( $social_icons, 'bastet-header-social' ); endif; if ( ( get_theme_mod( 'header_style', 'light' ) === 'solid' && ! get_theme_mod( 'header_social', false ) ) || ( get_theme_mod( 'top_header', false ) && get_theme_mod( 'header_style', 'light' ) === 'solid' ) ) : echo '
'; endif; } add_action( 'bastet_after_site_brand', 'bastet_header_social', 13 ); /** * Append header social icons if enabled */ function bastet_header_large_search() { if ( get_theme_mod( 'header_search', false ) && get_theme_mod( 'header_style', 'light' ) === 'large' ) : bastet_search_html(); endif; } add_action( 'bastet_before_site_brand', 'bastet_header_large_search', 13 ); /** * Append search icon for solid style */ function bastet_header_solid_search() { if ( get_theme_mod( 'header_search', false ) && 'solid' === get_theme_mod( 'header_style', 'light' ) ) { bastet_search_html(); } } add_action( 'bastet_after_site_brand', 'bastet_header_solid_search', 13 ); /** * Append header social for solid style */ function bastet_header_large_social() { if ( get_theme_mod( 'header_social', false ) && 'large' === get_theme_mod( 'header_style', 'light' ) ) : $social_icons = get_theme_mod( 'header_social_icons', array() ); bastet_social_icons( $social_icons, 'bastet-header-social' ); endif; } add_action( 'bastet_after_site_brand', 'bastet_header_large_social', 13 ); /** * Append site brand */ function bastet_hook_site_brand() { printf( '', esc_url( home_url( '/' ) ), bastet_get_site_brand() // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ); } add_action( 'bastet_site_brand', 'bastet_hook_site_brand', 12 ); /** * Render footer widgets based on the selected number of columns */ function bastet_footer_widgets_render_row() { $footer_columns = bastet_get_footer_columns_count( 'count' ); $columns_class = bastet_get_footer_columns(); echo '
'; for ( $i = 1; $i <= $footer_columns; $i++ ) { $column_class = bastet_get_footer_columns( $i ); echo sprintf( '
', esc_attr( $column_class ) ); bastet_sidebar_area( 'footer-' . $i . '' ); echo '
'; } echo '
'; } add_action( 'bastet_footer_widgets_row', 'bastet_footer_widgets_render_row', 11 ); /** * Append footer instagram widget area if enabled */ function bastet_instagram_footer_area() { echo ''; } add_action( 'bastet_before_footer_widgets', 'bastet_instagram_footer_area' ); /** * Append single title for large header style */ function bastet_post_header() { if ( bastet_get_single_layout() === 'large-header' ) : echo '
'; get_template_part( 'template-parts/single/title' ); echo '
'; endif; } add_action( 'bastet_before_single_content', 'bastet_post_header', 11 ); /** * Append single feature media for large header style */ function bastet_post_feature() { if ( 'large-header' === bastet_get_single_layout() && has_post_thumbnail() ) : echo '
'; get_template_part( 'template-parts/single/feature' ); echo '
'; endif; } add_action( 'bastet_before_single_content', 'bastet_post_feature', 12 ); /** * Append page title and feature media before page content */ function bastet_page_header() { echo '
'; get_template_part( 'template-parts/single/title' ); echo '
'; if ( has_post_thumbnail() ) : echo '
'; get_template_part( 'template-parts/single/feature' ); echo '
'; endif; } add_action( 'bastet_before_page_content', 'bastet_page_header', 12 ); /** * Append post feature media before post content for classic style */ function bastet_single_classic() { if ( 'classic' === bastet_get_single_layout() && has_post_thumbnail() ) : echo '
'; get_template_part( 'template-parts/single/feature' ); echo '
'; endif; } add_action( 'bastet_before_post_article', 'bastet_single_classic', 11 ); /** * Append post title after feature media for posts classic style */ function bastet_single_classic_title() { if ( 'classic' === bastet_get_single_layout() ) : echo '
'; get_template_part( 'template-parts/single/title' ); echo '
'; endif; } add_action( 'bastet_after_single_feature', 'bastet_single_classic_title', 11 ); /** * Append post title then feature media for classic-alt style */ function bastet_single_classic_alt() { if ( 'classic-alt' === bastet_get_single_layout() || is_page() ) : echo '
'; get_template_part( 'template-parts/single/title' ); echo '
'; if ( has_post_thumbnail() ) : echo '
'; get_template_part( 'template-parts/single/feature' ); echo '
'; endif; endif; } add_action( 'bastet_before_post_article', 'bastet_single_classic_alt', 14 ); /** * Include vert-header style */ function bastet_single_vert_header() { if ( bastet_get_single_layout() === 'vert-header' ) : echo '
'; get_template_part( 'template-parts/single/vert-header' ); echo '
'; endif; } add_action( 'bastet_before_single_main', 'bastet_single_vert_header', 14 ); /** * Append sidebar widgets are if enabled */ function bastet_single_sidebar() { if ( bastet_get_sidebar_position() === 'left-sidebar' || bastet_get_sidebar_position() === 'right-sidebar' ) : $sidebar_id = is_page() ? 'page' : 'post'; printf( '' ); endif; } add_action( 'bastet_singular_sidebar', 'bastet_single_sidebar', 11 ); /** * Append post author box if enabled */ function bastet_hook_author_box() { if ( is_single() && get_theme_mod( 'single_author_box', false ) ) : get_template_part( 'template-parts/single/authorbox' ); endif; } add_action( 'bastet_after_post_article', 'bastet_hook_author_box', 11 ); /** * Append post next/prev on single */ function bastet_hook_post_pagination() { if ( is_single() ) : get_template_part( 'template-parts/single/pagination' ); endif; } add_action( 'bastet_after_post_article', 'bastet_hook_post_pagination', 11 ); /** * Append post comments template if enabled */ function bastet_hook_single_comments() { if ( comments_open() || get_comments_number() ) : comments_template(); endif; } add_action( 'bastet_after_post_article', 'bastet_hook_single_comments', 12 ); /** * Append page comments template if enabled */ function bastet_hook_page_comments() { if ( comments_open() || get_comments_number() ) : comments_template(); endif; } add_action( 'bastet_after_page_article', 'bastet_hook_page_comments', 12 ); /** * Include archive title template before the main query */ function bastet_hook_archive_title() { get_template_part( 'template-parts/archive-title' ); } add_action( 'bastet_before_archive_loop', 'bastet_hook_archive_title', 12 ); /** * Include search title template before the main query */ function bastet_hook_search_title() { get_template_part( 'template-parts/search-title' ); } add_action( 'bastet_before_search_loop', 'bastet_hook_search_title', 12 ); /** * Append offcanvas sidebar after site footer */ function bastet_hook_offcanvas_sidebar() { bastet_offcanvas_sidebar(); } add_action( 'bastet_after_site_footer', 'bastet_hook_offcanvas_sidebar', 12 ); /** * Append offcanvas search after site footer */ function bastet_hook_offcanvas_search() { if ( get_theme_mod( 'header_search', false ) ) { bastet_offcancas_search(); } } add_action( 'bastet_after_site_footer', 'bastet_hook_offcanvas_search', 12 ); /** * Append theme primary sidebar */ function bastet_hook_main_sidebar() { bastet_sidebar(); } add_action( 'bastet_main_sidebar_area', 'bastet_hook_main_sidebar', 12 );