'; } } add_action( 'wp_head', 'amathambo_pingback_header' ); } if ( ! function_exists( 'amathambo_dynamic_widgets' ) ) { /** * Add dynamic widget areas in footer. */ function amathambo_dynamic_widgets() { $widget_area = sanitize_html_class( 'footer-widget-area' ); $widget = sanitize_html_class( 'widget-area-' ); $sidebar_prefix = 'footer-'; echo ''; } } // End if(). if ( ! function_exists( 'amathambo_custom_excerpt_length' ) ) { /** * Filter the except length to 25 words. * * @param int $length Excerpt length. * @return int (Maybe) modified excerpt length. */ function amathambo_custom_excerpt_length( $length ) { return 25; } add_filter( 'excerpt_length', 'amathambo_custom_excerpt_length', 999 ); /** * Change ending of excerpt. * * @param int $more excerpt ending. * @return string. */ function amathambo_excerpt_more( $more ) { return '...'; } add_filter( 'excerpt_more', 'amathambo_excerpt_more' ); } if ( ! function_exists( 'amathambo_gutenberg_color_palette' ) ) { /** * Add support for custom color palettes in Gutenberg. */ function amathambo_gutenberg_color_palette() { add_theme_support( 'editor-color-palette', array( array( 'name' => esc_html__( 'White', 'amathambo' ), 'slug' => 'white', 'color' => '#ffffff', ), array( 'name' => esc_html__( 'Lightest Grey', 'amathambo' ), 'slug' => 'lightest-grey', 'color' => '#f5f5f5', ), array( 'name' => esc_html__( 'Lighter Grey', 'amathambo' ), 'slug' => 'lighter-grey', 'color' => '#d1d1d1', ), array( 'name' => esc_html__( 'Light Grey', 'amathambo' ), 'slug' => 'light-grey', 'color' => '#575757', ), array( 'name' => esc_html__( 'Red', 'amathambo' ), 'slug' => 'red', 'color' => '#a30f1e', ), array( 'name' => esc_html__( 'Blue', 'amathambo' ), 'slug' => 'blue', 'color' => '#15587e', ), array( 'name' => esc_html__( 'Black', 'amathambo' ), 'slug' => 'black', 'color' => '#000000', ), ) ); } add_action( 'after_setup_theme', 'amathambo_gutenberg_color_palette' ); } // End if(). if ( ! function_exists( 'amathambo_search_filter' ) ) { if ( ! is_admin() ) { /** * Exclude pages from WordPress search results. * * @param string $query search query. * @return string search results without pages. */ function amathambo_search_filter( $query ) { if ( $query->is_search ) { $query->set( 'post_type', 'post' ); } return $query; } add_filter( 'pre_get_posts','amathambo_search_filter' ); } } if ( ! function_exists( 'amathambo_comment_args' ) ) { /** * Sets arguments for comments * Sets comment policy, the reply title on the comment form as well as sets the textarea to required. */ function amathambo_comment_args() { $commenter = wp_get_current_commenter(); $req = get_option( 'require_name_email' ); $aria_req = ( $req ? " aria-required='true'" : '' ); $fields = array( 'author' => '

' . ( $req ? '*' : '' ) . '

', 'email' => '

' . ( $req ? '*' : '' ) . '

', 'url' => '


', ); $consent = empty( $commenter['comment_author_email'] ) ? '' : ' checked="checked"'; $fields['cookies'] = ''; if ( isset( $args['fields'] ) && ! isset( $args['fields']['cookies'] ) ) { $args['fields']['cookies'] = $fields['cookies']; } $comments_args = array( 'title_reply' => __( 'Start or Join the Conversation', 'amathambo' ), 'comment_notes_after' => '', 'comment_field' => '


', 'fields' => apply_filters( 'comment_form_default_fields', $fields ), ); comment_form( $comments_args ); } add_action( 'amathambo_comment_args', 'amathambo_comment_args' ); } if ( ! function_exists( 'amathambo_top_link' ) ) { /** * Add scroll to top button */ function amathambo_top_link() { echo 'TopScroll to top of screen'; } add_action( 'wp_footer', 'amathambo_top_link' ); } if ( ! function_exists( 'amathambo_dynamic_widgets' ) ) { /** * Add dynamic widget areas in footer. */ function amathambo_dynamic_widgets() { $widget_area = sanitize_html_class( 'footer-widget-area' ); $widget = sanitize_html_class( 'widget-area-' ); $sidebar_prefix = 'footer-'; echo '
'; $active = 0; for ( $count = 1; $count <= 3; $count++ ) { $sidebar = $sidebar_prefix; $sidebar .= (int) $count; if ( is_active_sidebar( $sidebar ) ) { $active++; } } if ( $active > 0 ) { $widget .= (int) $active; for ( $count = 1; $count <= 3; $count++ ) { $sidebar = $sidebar_prefix; $sidebar .= (int) $count; if ( is_active_sidebar( $sidebar ) ) { echo '
'; dynamic_sidebar( $sidebar ); echo '
'; } } echo '
'; } echo '';?> theme_location ) { $items .= ''; } return $items; } add_filter( 'wp_nav_menu_items', 'amathambo_add_search_form', 10, 2 ); } if ( ! function_exists( 'amathambo_custom_logo_in_title_css' ) ) { /** * Adds custom logo to site-title. */ function amathambo_custom_logo_in_title_css() { $custom_logo_id = get_theme_mod( 'custom_logo' ); $image = wp_get_attachment_image_src( $custom_logo_id , 'full' ); $amathambo_title_background_image = $image[0]; if ( is_rtl() ) { $css = '.wp-custom-logo .site-title a {background-image: url("%1$s");background-size: 32px 32px;background-position: right center;background-repeat: no-repeat;padding-right: 37px;}'; } else { $css = '.wp-custom-logo .site-title a {background-image: url("%1$s");background-size: 32px 32px;background-position: left center;background-repeat: no-repeat;padding-left: 37px;}'; } wp_add_inline_style( 'amathambo-style', sprintf( $css, $amathambo_title_background_image ) ); } add_action( 'wp_enqueue_scripts', 'amathambo_custom_logo_in_title_css', 11 ); } if ( ! function_exists( 'amathambo_custom_required' ) ) { /** * Customize required field labels on JetPack contact form. */ function amathambo_custom_required() { return __( ' *', 'amathambo' ); } add_filter( 'jetpack_required_field_text', 'amathambo_custom_required' ); }