', esc_url( get_bloginfo( 'pingback_url' ) ) ); } } add_action( 'wp_head', 'astrad_pingback_header' ); /** * Enqueue scripts and styles. */ function astrad_scripts_assets() { wp_enqueue_style( 'astrad-fonts', astrad_fonts_url(), array(), null ); wp_enqueue_style( 'astrad-style', get_stylesheet_uri(), array(), astrad_THEME_VERSION ); wp_style_add_data( 'astrad-style', 'rtl', 'replace' ); wp_enqueue_style( 'fontawesome', get_template_directory_uri() . '/assets/css/font-awesome/css/all.css' ); wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/assets/css/bootstrap.css' ); wp_enqueue_style( 'astrad-main-style', get_template_directory_uri() . '/assets/css/main-style.css' ); wp_enqueue_style( 'astrad-responsive', get_template_directory_uri() . '/assets/css/responsive.css' ); wp_enqueue_script( 'bootstrap-js', get_template_directory_uri() . '/assets/js/bootstrap.js', array( 'jquery' ), astrad_THEME_VERSION, true ); wp_enqueue_script( 'astrad-custom-script', get_template_directory_uri() . '/assets/js/custom.js', array( 'jquery' ), astrad_THEME_VERSION, true ); $sticky = astrad_theme_mod_option( 'astrad_menu_sticky_option' ); wp_localize_script( 'astrad-custom-script', 'ajax_admin', array( 'sticky_check' => $sticky, )); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'wp_enqueue_scripts', 'astrad_scripts_assets' ); /** * Styles the header image and custom css. * * @see astrad_custom_style(). */ function astrad_custom_style() { $header_text_color = get_header_textcolor(); $header_image = get_header_image(); $custom_css = ""; $fwidget_color = astrad_theme_mod_option( 'astrad_fwidget_text_color' ); $copyright_color = astrad_theme_mod_option( 'astrad_copyright_text_color' ); $theme_color = astrad_theme_mod_option( 'astrad_theme_color' ); $link_color = astrad_theme_mod_option( 'astrad_link_color' ); $btn_color = astrad_theme_mod_option( 'astrad_btn_color' ); $btn_border_color = astrad_theme_mod_option( 'astrad_btn_border_color' ); $btn_hover_color = astrad_theme_mod_option( 'astrad_btn_hover_color' ); $hover_border_color = astrad_theme_mod_option( 'astrad_btn_hover_border_color' ); // If we get this far, we have custom styles. Let's do this. wp_enqueue_style( 'astrad-inline-style', get_template_directory_uri().'/assets/css/astrad-inline-style.css', array(), astrad_THEME_VERSION ); if ( has_header_image() ) : $custom_css .= ".header-wrapper{ background: linear-gradient(to bottom, rgb(0 0 0 / 25%) 0%, rgb(0 0 0 / 25%) 59%, rgb(0 0 0 / 25%) 100%), url( ".esc_attr( $header_image )." ) no-repeat; background-size: cover; background-repeat: no-repeat; }"; endif; if ( display_header_text() ) : $custom_css .= ".site-title a, .site-description { color: #".esc_attr( $header_text_color )."; } .main-navigation li>a { color: #".esc_attr( $header_text_color )."; }"; endif; if ( ! empty ( $theme_color ) ) { $custom_css .= ":root { --astrad-primary: ".esc_attr( $theme_color )."; }"; } if ( ! empty ( $link_color ) ) { $custom_css .= ".posted-on a, .entry-footer a, .site-info a, .author.vcard a { color: ".esc_attr( $link_color )."!important; }"; } if ( ! empty ( $btn_color ) ) { $custom_css .= ".btn-astrad-button { background-color: ".esc_attr( $btn_color )."; } .search-form .search-submit { background-color: ".esc_attr( $btn_color )."; } span.page-numbers.current { background: ".esc_attr( $btn_color )."; } .comment-body a.comment-reply-link, #commentform input#submit { background-color: ".esc_attr( $btn_color )."; }"; } if ( ! empty ( $btn_border_color ) ) { $custom_css .= ".btn-astrad-button { border: 1px solid ".esc_attr( $btn_border_color )."; } .navigation.pagination .page-numbers { border: 1px solid ".esc_attr( $btn_border_color )."; } .comment-body a.comment-reply-link, #commentform input#submit { border: 1px solid ".esc_attr( $btn_border_color )."; }"; } if ( ! empty ( $btn_hover_color ) ) { $custom_css .= " .btn-astrad-button:hover { background-color: ".esc_attr( $btn_hover_color )."; } .navigation.pagination .page-numbers:hover { background: ".esc_attr( $btn_hover_color )."; } .comment-body a.comment-reply-link:hover { background-color: ".esc_attr( $btn_hover_color )."; }"; } if ( ! empty ( $hover_border_color ) ) { $custom_css .= " .btn-astrad-button:hover { border: 1px solid ".esc_attr( $hover_border_color )."; } .comment-body a.comment-reply-link:hover { border: 1px solid ".esc_attr( $hover_border_color )."; }"; } if ( ! empty ( $fwidget_color ) ) { $custom_css .= ".site-footer { background-color: ".esc_attr( $fwidget_color )."; }"; } if ( ! empty ( $copyright_color ) ) { $custom_css .= ".site-info { background-color: ".esc_attr( $copyright_color )."; }"; } wp_add_inline_style( 'astrad-inline-style', $custom_css ); } add_action( 'wp_enqueue_scripts', 'astrad_custom_style' ); /** * Excerpt length * * @since astrad 1.0.0 * @return Excerpt length */ function astrad_excerpt_length( $length ){ if ( is_admin() ) { return $length; } $length = astrad_theme_mod_option( 'astrad_blog_excerpt_length' ); return $length; } add_filter( 'excerpt_length', 'astrad_excerpt_length', 999 ); /** * Comment Form field position */ function astrad_comment_field_to_bottom( $fields ) { $comment_field = $fields['comment']; unset( $fields['comment'] ); $fields['comment'] = $comment_field; return $fields; } add_filter( 'comment_form_fields', 'astrad_comment_field_to_bottom' ); /** * Default comment form includes name, email address and website URL * Default comment form elements are hidden when user is logged in */ add_filter( 'comment_form_default_fields', 'astrad_comment_custom_fields' ); function astrad_comment_custom_fields( $fields ) { $commenter = wp_get_current_commenter(); $req = get_option( 'require_name_email' ); $aria_req = ( $req ? " aria-required='true'" : ’ ); $fields[ 'author' ] = '
'; $fields[ 'email' ] = '
'; $fields[ 'url' ] = '
'; return $fields; }