document.body.classList.remove("no-js");'; } add_action( 'wp_footer', 'alurra_supports_js' ); /* COMMENT AUTHOR LABEL Check if the specified comment is written by the author. ==================================================== */ if ( ! function_exists( 'alurra_is_comment_by_post_author' ) ) : function alurra_is_comment_by_post_author( $comment = null ) { if ( is_object( $comment ) && $comment->user_id > 0 ) { $user = get_userdata( $comment->user_id ); $post = get_post( $comment->comment_post_ID ); if ( ! alurra( $user ) && ! alurra( $post ) ) { return $comment->user_id === $post->post_author; } } return false; } endif; /* CHANGE COMMENT FORM DEFAULT FIELDS ==================================================== */ /* Fields wrapper */ function alurra_comment_form_before_fields() { echo '
'; } add_action('comment_form_before_fields', 'alurra_comment_form_before_fields'); function alurra_comment_form_after_fields() { echo '
'; } add_action('comment_form_after_fields', 'alurra_comment_form_after_fields'); // Comment fields function comment_form_default_fields( $fields ) { $commenter = wp_get_current_commenter(); $req = get_option( 'require_name_email' ); $aria_req = ( $req ? " aria-required='true'" : '' ); $html_req = ( $req ? " required='required'" : '' ); $html5 = 'html5'; $fields['author'] = '

'; $fields['email'] = '

'; $fields['url'] = '

'; return $fields; // Comment form fields add_filter( 'comment_form_default_fields', 'comment_form_default_fields', 10, 1 ); } /* CHANGE THE AVATAR SIZE ==================================================== */ function alurra_get_avatar_size() { return 60; } /* ADD A TITLE TO POSTS MISSING TITLES When a post is missing a title, a default title will be used. ==================================================== */ if ( ! function_exists( 'alurra_post_title' ) ) { function alurra_post_title( $title ) { return '' === $title ? esc_html_x( 'Untitled', 'Added to posts and pages that are missing titles', 'alurra' ) : $title; } } add_filter( 'the_title', 'alurra_post_title' ); /* ARCHIVE TITLE PREFIX Styles the archive title prefix with a span ==================================================== */ function alurra_prefix_archive_title( $title ) { $regex = apply_filters( 'alurra_prefix_the_archive_title_regex', array( 'pattern' => '/(\A[^\:]+\:)/', 'replacement' => '$1', ) ); if ( empty( $regex ) ) { return $title; } return preg_replace( $regex['pattern'], $regex['replacement'], $title ); } add_filter( 'get_the_archive_title', 'alurra_prefix_archive_title' ); /* ARCHIVE TITLES Change how archive titles are displayed ==================================================== */ if( ! function_exists( 'alurra_get_the_archive_title' ) ) : function alurra_get_the_archive_title( $title ){ $archive_prefix = esc_attr( get_theme_mod( 'alurra_hide_prefix_archive', 1 ) ); // If enabled - the prefix archive label is hidden if( $archive_prefix ) { if ( is_category() ) { return single_cat_title( '', false ); } elseif ( is_author() ) { return get_the_author(); } elseif( is_post_type_archive( 'portfolio' ) ) { return esc_html__( 'Portfolio', 'alurra' ); } } return $title; } endif; add_filter( 'get_the_archive_title', 'alurra_get_the_archive_title' ); /* FILTER CLASSES OF WP_LIST_PAGES ITEMS TO MATCH MENU ITEMS Filter the class applied to wp_list_pages() items with children to match the menu class, to simplify styling of sub levels in the fallback. ==================================================== */ if ( ! function_exists( 'alurra_filter_wp_list_pages_item_classes' ) ) : function alurra_filter_wp_list_pages_item_classes( $css_class, $item, $depth, $args, $current_page ) { // Only apply to wp_list_pages() calls with match_menu_classes set to true $match_menu_classes = isset( $args['match_menu_classes'] ); if ( ! $match_menu_classes ) { return $css_class; } // Add current menu item class if ( in_array( 'current_page_item', $css_class ) ) { $css_class[] = 'current-menu-item'; } // Add menu item has children class if ( in_array( 'page_item_has_children', $css_class ) ) { $css_class[] = 'menu-item-has-children'; } return $css_class; } add_filter( 'page_css_class', 'alurra_filter_wp_list_pages_item_classes', 10, 5 ); endif; /* FILTER THE EXCERPT LENGTH Customizable excerpt length ==================================================== */ if ( ! function_exists( 'alurra_excerpt_length' ) ) { function alurra_excerpt_length( $length ) { if ( is_admin() ) { return $length; } $excerpt_length = esc_attr(get_theme_mod( 'alurra_excerpt_length', '35' ) ); return $excerpt_length; } } add_filter( 'excerpt_length', 'alurra_excerpt_length', 99 ); /* FILTER THE EXCERPT SUFFIX Replaces the default [...] with a … (three dots) ==================================================== */ if ( ! function_exists( 'alurra_excerpt_more' ) ) : function alurra_excerpt_more() { return '…'; } add_filter( 'excerpt_more', 'alurra_excerpt_more' ); endif; /* MOVE READ MORE LINK OUTSIDE OF PARAGRAPHS Move the 'continue reading' link outside of paragraph. ==================================================== */ if ( ! function_exists( 'alurra_move_more_link' ) ) : function alurra_move_more_link() { $alurra_readmore_text = esc_html( get_theme_mod( 'alurra_readmore_text', esc_html__('Continue Reading…', 'alurra') ) ); //if ( false == esc_attr(get_theme_mod( 'alurra_hide_blog_readmore', false ) ) ) { return '

' . wp_kses_post( $alurra_readmore_text ) . '

'; //} } add_filter( 'the_content_more_link', 'alurra_move_more_link' ); endif; /* CREATE A CONTINUE READING LINK FOR EXCERPTS ==================================================== */ if ( ! function_exists( 'alurra_read_more_link' ) ) : function alurra_read_more_link() { $alurra_readmore_text = esc_html( get_theme_mod( 'alurra_readmore_text', esc_html__('Continue Reading…', 'alurra') ) ); echo ''; } endif; /* POST HEADER This displays the full post header above content ==================================================== */ if ( ! function_exists( 'alurra_full_post_header' ) ) : function alurra_full_post_header() { echo '
'; if ( !esc_attr(get_theme_mod( 'alurra_hide_post_category', 1 ))) { alurra_featured_cat_labels(); } the_title( '

', '

' ); if (!esc_attr(get_theme_mod( 'alurra_hide_post_entry_meta', 1 ))) { alurra_entry_meta( '
', '
' ); } echo '
'; } endif; /* CAN POST THUMBNAIL BE DISPLAYED Determines if post thumbnail can be displayed. ==================================================== */ function alurra_can_show_post_thumbnail() { return apply_filters( 'alurra_can_show_post_thumbnail', ! post_password_required() && ! is_attachment() && has_post_thumbnail() ); } /* RETURN SVG CODE FOR ICON Gets the SVG code for a given icon. ==================================================== */ function alurra_get_icon_svg( $group, $icon, $size = 24 ) { return Alurra_SVG_Icons::get_svg( $group, $icon, $size ); } /* --------------------------------------------------------------------------------------------- RETURN SVG CODE FOR SOCIAL ICONS Detects the social network from a URL and returns the SVG code for its icon. ---------------------------------------------------------------------------------------------*/ function alurra_get_social_link_svg( $uri, $size = 24 ) { return Alurra_SVG_Icons::get_social_link_svg( $uri, $size ); } /* --------------------------------------------------------------------------------------------- ADDS SVG ICON FOR SOCIAL MENUS Displays SVG icons in the social navigation. ---------------------------------------------------------------------------------------------*/ function alurra_nav_menu_social_icons( $item_output, $item, $depth, $args ) { // Change SVG icon inside social links menu if there is supported URL. if ( 'top-social' === $args->theme_location || 'bottom-social' === $args->theme_location ) { $svg = alurra_get_social_link_svg( $item->url, 24 ); if ( ! empty( $svg ) ) { $item_output = str_replace( $args->link_before, $svg, $item_output ); } } return $item_output; } add_filter( 'walker_nav_menu_start_el', 'alurra_nav_menu_social_icons', 10, 4 ); /* ADD CONTAINER FOR SUBMENU ICON Add a dropdown icon if menu item has children. ==================================================== */ function alurra_dropdown_icon_to_menu_link( $title, $item, $args, $depth ) { if ( 'primary' === $args->theme_location ) { foreach ( $item->classes as $value ) { if ( 'menu-item-has-children' === $value || 'page_item_has_children' === $value ) { $title = $title . ''; } } } return $title; } add_filter( 'nav_menu_item_title', 'alurra_dropdown_icon_to_menu_link', 10, 4 ); /* MODIFY THE WP SEARCH FORM ==================================================== */ function search_form( $form ) { $form = '
'; return $form; } add_filter( 'get_search_form', 'search_form' ); /* WEB SAFE FONTS Return Web safe font and google font ==================================================== */ if( ! function_exists( 'alurra_get_all_fonts' ) ) : function alurra_get_all_fonts(){ $google = array(); $standard = array( 'georgia-serif' => esc_html__( 'Georgia', 'alurra' ), 'palatino-serif' => esc_html__( 'Palatino Linotype, Book Antiqua, Palatino', 'alurra' ), 'times-serif' => esc_html__( 'Times New Roman, Times', 'alurra' ), 'arial-helvetica' => esc_html__( 'Arial, Helvetica', 'alurra' ), 'arial-gadget' => esc_html__( 'Arial Black, Gadget', 'alurra' ), 'comic-cursive' => esc_html__( 'Comic Sans MS, cursive', 'alurra' ), 'impact-charcoal' => esc_html__( 'Impact, Charcoal', 'alurra' ), 'lucida' => esc_html__( 'Lucida Sans Unicode, Lucida Grande', 'alurra' ), 'tahoma-geneva' => esc_html__( 'Tahoma, Geneva', 'alurra' ), 'trebuchet-helvetica' => esc_html__( 'Trebuchet MS, Helvetica', 'alurra' ), 'verdana-geneva' => esc_html__( 'Verdana, Geneva', 'alurra' ), 'courier' => esc_html__( 'Courier New, Courier', 'alurra' ), 'lucida-monaco' => esc_html__( 'Lucida Console, Monaco', 'alurra' ), ); $fonts = include wp_normalize_path( get_template_directory() . '/inc/customizer/custom-controls/typography/webfonts.php' ); foreach( $fonts['items'] as $font ){ $google[$font['family']] = $font['family']; } $all_fonts = array_merge( $standard, $google ); return $all_fonts; } endif; /* POST COMMENTS This sets up the post comments. ====================================================*/ if (!function_exists('alurra_post_comments')) : function alurra_post_comments() { // If comments are open or we have at least one comment, load up the comment template. if ( comments_open() || get_comments_number() ) : comments_template(); endif; } endif; /* POST HEADING This sets up the post heading for the title, featured image, etc. ====================================================*/ if (!function_exists('alurra_post_header')) : function alurra_post_header() { // Get our post layout to determine what to display $alurra_single_layout = get_theme_mod( 'alurra_single_layout','classic-right' ); if ( $alurra_single_layout === 'center' || $alurra_single_layout === 'classic-left' || $alurra_single_layout === 'classic-right' ) { echo '
'; alurra_featured_cat_labels(); the_title( '

', '

' ); alurra_entry_meta( '
', '
' ); echo '
'; alurra_post_thumbnail(); } } endif; /* HEADER BRANDING This sets up the basic site header branding ====================================================*/ if (!function_exists('alurra_header_branding')) : function alurra_header_branding() { $description = get_bloginfo( 'description', 'display' ); echo '
'; alurra_site_identity(); if ( $description && esc_attr(get_theme_mod( 'alurra_show_site_desc', 1 ) ) ) { echo '

' . esc_html( $description ) . '

'; echo '
'; } } endif;