'; } } 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 '