tag. */ do_action( 'wp_body_open' ); } } if ( ! function_exists( 'aqwa_body_classes' ) ) { /** * Adds custom classes to the array of body classes. * * @since aqwa 1.0 * * @return void */ function aqwa_body_classes( $classes ) { if ( is_multi_author() ) { $classes[] = 'group-blog'; } // body class $classes[] = 'aqwa-body'; // Helps detect if JS is enabled or not. $classes[] = 'no-js'; // Adds `singular` to singular pages, and `hfeed` to all other pages. $classes[] = is_singular() ? 'singular' : 'hfeed'; return $classes; } add_filter( 'body_class', 'aqwa_body_classes' ); } if ( ! function_exists( 'aqwa_post_classes' ) ) { /** * Adds custom class to the array of posts classes. * * @since aqwa 1.0 * * @return void */ function aqwa_post_classes( $classes ) { $classes[] = 'entry'; return $classes; } add_filter( 'post_class', 'aqwa_post_classes', 10, 3 ); } if ( ! function_exists( 'aqwa_comment_form_defaults' ) ) { function aqwa_comment_form_defaults( $defaults ) { // Adjust height of comment form. $defaults['comment_field'] = preg_replace( '/rows="\d+"/', 'rows="5"', $defaults['comment_field'] ); return $defaults; } add_filter( 'comment_form_defaults', 'aqwa_comment_form_defaults' ) ; } if ( ! function_exists( 'aqwa_social_menu' ) ) { // jetpack social menu function aqwa_jetpack_social_menu() { if ( ! function_exists( 'jetpack_social_menu' ) ) { return; } else { jetpack_social_menu(); } } add_action( 'init', 'aqwa_jetpack_social_menu' ); } if ( ! function_exists( 'aqwa_print_first_instance_of_block' ) ) { /** * Print the first instance of a block in the content, and then break away. * */ function aqwa_print_first_instance_of_block( $block_name, $content = null, $instances = 1 ) { $instances_count = 0; $blocks_content = ''; if ( ! $content ) { $content = get_the_content(); } // Parse blocks in the content. $blocks = parse_blocks( $content ); // Loop blocks. foreach ( $blocks as $block ) { // Sanity check. if ( ! isset( $block['blockName'] ) ) { continue; } // Check if this the block matches the $block_name. $is_matching_block = false; // If the block ends with *, try to match the first portion. if ( '*' === $block_name[-1] ) { $is_matching_block = 0 === strpos( $block['blockName'], rtrim( $block_name, '*' ) ); } else { $is_matching_block = $block_name === $block['blockName']; } if ( $is_matching_block ) { // Increment count. $instances_count++; // Add the block HTML. $blocks_content .= render_block( $block ); // Break the loop if the $instances count was reached. if ( $instances_count >= $instances ) { break; } } } if ( $blocks_content ) { echo apply_filters( 'the_content', $blocks_content ); // phpcs:ignore WordPress.Security.EscapeOutput return true; } return false; } } if ( ! function_exists( 'aqwa_breadcrumb_title' ) ) { //Theme breadcrumb title function aqwa_breadcrumb_title(){ if ( is_front_page() || is_home() ){ single_post_title(); }elseif ( is_category() ){ printf( __( 'Category Archives: %s', 'aqwa' ), ( single_cat_title( '', false ) )); }elseif ( is_tag() ){ printf( __( 'Tag Archives: %s', 'aqwa' ), ( single_tag_title( '', false ) )); }elseif ( is_404() ){ printf( __( 'Error 404', 'aqwa' )); }elseif ( is_author() ){ printf( __( 'Author: %s', 'aqwa' ), ( get_the_author( '', false ) )); }elseif ( is_day() ) { printf( __( 'Daily Archives: %s', 'aqwa' ), get_the_date() ); }elseif ( is_month() ){ printf( __( 'Monthly Archives: %s', 'aqwa' ), ( get_the_date( 'F Y' ) )); }elseif ( is_year() ) { printf( __( 'Yearly Archives: %s', 'aqwa' ), ( get_the_date( 'Y' ) ) ); }else { the_title(); } } } if ( ! function_exists( 'aqwa_breadcrumb_content' ) ) { function aqwa_breadcrumb_content() { $showOnHome = esc_html__('1','aqwa'); // 1 - Show breadcrumbs on the homepage, 0 - don't show $delimiter = ''; // Delimiter between breadcrumb $home = esc_html__('Home','aqwa'); // Text for the 'Home' link $showCurrent= esc_html__('1','aqwa'); // Current post/page title in breadcrumb in use 1, Use 0 for don't show $before = '
  • '; // Tag before the current Breadcrumb $after = '
  • '; // Tag after the current Breadcrumb $seprator = get_theme_mod('seprator','::'); global $post; $homeLink = home_url(); if (is_home() || is_front_page()) { if ($showOnHome == 1) echo '
  • ' . esc_html($home) . '
  • '; } else { echo '
  • ' . esc_html($home) . ' ' . ' ' . wp_kses_post($seprator) . ' '; if ( is_category() ) { $thisCat = get_category(get_query_var('cat'), false); if ($thisCat->parent != 0) echo get_category_parents($thisCat->parent, TRUE, ' ' . ' '); echo $before . esc_html__('Archive by category','aqwa').' "' . esc_html(single_cat_title('', false)) . '"' .$after; } elseif ( is_search() ) { echo $before . esc_html__('Search results for ','aqwa').' "' . esc_html(get_search_query()) . '"' . $after; } elseif ( is_day() ) { echo '' . esc_html(get_the_time('Y')) . ' ' . ' ' . wp_kses_post($seprator) . ' '; echo '' . esc_html(get_the_time('F')) . ' '. ' ' . wp_kses_post($seprator) . ' '; echo $before . esc_html(get_the_time('d')) . $after; } elseif ( is_month() ) { echo '' . esc_html(get_the_time('Y')) . ' ' . esc_attr($delimiter) . ' ' . wp_kses_post($seprator) . ' '; echo $before . esc_html(get_the_time('F')) . $after; } elseif ( is_year() ) { echo $before . esc_html(get_the_time('Y')) . $after; } elseif ( is_single() && !is_attachment() ) { if ( get_post_type() != 'post' ) { $post_type = get_post_type_object(get_post_type()); $slug = $post_type->rewrite; echo '' . $post_type->labels->singular_name . ''; if ($showCurrent == 1) echo ' ' . esc_attr($delimiter) . ' ' . wp_kses_post($seprator) . ' ' . $before . wp_kses_post(get_the_title()) . $after; } else { if ($showCurrent == 1) echo $before . esc_html(get_the_title()) . $after; } } elseif ( !is_single() && !is_page() && get_post_type() != 'post' && !is_404() ) { if ( class_exists( 'WooCommerce' ) ) { if ( is_shop() ) { $thisshop = woocommerce_page_title(); } } else { $post_type = get_post_type_object(get_post_type()); echo $before . $post_type->labels->singular_name . $after; } } elseif ( !is_single() && !is_page() && get_post_type() != 'post' && !is_404() ) { $post_type = get_post_type_object(get_post_type()); echo $before . $post_type->labels->singular_name . $after; } elseif ( is_attachment() ) { $parent = get_post($post->post_parent); $cat = get_the_category($parent->ID); if(!empty($cat)){ $cat = $cat[0]; echo get_category_parents($cat, TRUE, ' ' . esc_attr($delimiter) . ' ' . wp_kses_post($seprator) . ' '); } echo '' . $parent->post_title . ''; if ($showCurrent == 1) echo ' ' . esc_attr($delimiter) . ' ' . $before . esc_html(get_the_title()) . $after; } elseif ( is_page() && !$post->post_parent ) { if ($showCurrent == 1) echo $before . esc_html(get_the_title()) . $after; } elseif ( is_page() && $post->post_parent ) { $parent_id = $post->post_parent; $breadcrumbs = array(); while ($parent_id) { $page = get_page($parent_id); $breadcrumbs[] = '' . esc_html(get_the_title($page->ID)) . '' . ' ' . wp_kses_post($seprator) . ' '; $parent_id = $page->post_parent; } $breadcrumbs = array_reverse($breadcrumbs); for ($i = 0; $i < count($breadcrumbs); $i++) { echo $breadcrumbs[$i]; if ($i != count($breadcrumbs)-1) echo ' ' . esc_attr($delimiter) . ' ' . wp_kses_post($seprator) . ' '; } if ($showCurrent == 1) echo ' ' . esc_attr($delimiter) . ' ' . $before . esc_html(get_the_title()) . $after; } elseif ( is_tag() ) { echo $before . esc_html__('Posts tagged ','aqwa').' "' . esc_html(single_tag_title('', false)) . '"' . $after; } elseif ( is_author() ) { global $author; $userdata = get_userdata($author); echo $before . esc_html__('Articles posted by ','aqwa').'' . $userdata->display_name . $after; } elseif ( is_404() ) { echo $before . esc_html__('Error 404 ','aqwa'). $after; } if ( get_query_var('paged') ) { if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ''; echo ' ( ' . esc_html__('Page','aqwa') . '' . esc_html(get_query_var('paged')). ' )'; if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ''; } echo '
  • '; } } }