RegisterNavMenus(); $this->Filters(); $this->Actions(); add_action( 'after_setup_theme', array( $this, 'ThemeSetup' ) ); } /** * Usage: Load language file */ function LoadTextDoamin() { load_theme_textdomain( 'attire', get_template_directory() . '/languages' ); } function Filters() { } function Actions() { add_action( 'wp_enqueue_scripts', array( $this, 'enqueueScripts' ) ); add_action( 'wp_enqueue_scripts', array( $this, 'enqueuePriorityScripts' ), 1 ); } function enqueuePriorityScripts() { wp_register_style('font-awesome', ATTIRE_TEMPLATE_URL . '/fonts/fontawesome/css/all.min.css'); wp_enqueue_style('font-awesome'); } /** * @usage Load all necessary scripts & styles */ function enqueueScripts() { $theme_mod = get_option( 'attire_options' ); // Font Options ( From Customizer Typography Options ) $family[] = sanitize_text_field( $theme_mod['heading_font'] ); $family[] = sanitize_text_field( $theme_mod['body_font'] ); $family[] = sanitize_text_field( $theme_mod['widget_title_font'] ); $family[] = sanitize_text_field( $theme_mod['widget_content_font'] ); $family[] = sanitize_text_field( $theme_mod['menu_top_font'] ); $family[] = sanitize_text_field( $theme_mod['menu_dropdown_font'] ); $family = array_unique( $family ); // echo '
'.json_encode($theme_mod,JSON_PRETTY_PRINT).'
'; $cssimport = '//fonts.googleapis.com/css?family=' . implode( "|", $family ); $cssimport = str_replace( '||', '|', $cssimport ); wp_enqueue_script( 'jquery' ); //attire-mbl-menu //wp_register_script( 'attire-gn-classie', ATTIRE_TEMPLATE_URL . '/mobile-menu-rss/js/classie.js', array(), null, true ); //wp_enqueue_script( 'attire-gn-classie' ); //wp_register_script( 'attire-gn-gnm', ATTIRE_TEMPLATE_URL . '/mobile-menu-rss/js/gnmenu.js', array(), null, true ); //wp_enqueue_script( 'attire-gn-gnm' ); wp_register_script( 'attire-sticky', ATTIRE_TEMPLATE_URL . '/js/jquery.sticky.js', array('jquery'), null, true ); wp_enqueue_script( 'attire-sticky' ); wp_register_style( 'attire-responsive', ATTIRE_TEMPLATE_URL . '/css/responsive.css' ); wp_enqueue_style( 'attire-responsive' ); wp_register_style( 'bootstrap', ATTIRE_TEMPLATE_URL . '/bootstrap/css/bootstrap.min.css' ); wp_enqueue_style( 'bootstrap' ); wp_register_style( 'attire-main', get_stylesheet_uri(), array( 'bootstrap', 'attire-responsive' ) ); wp_enqueue_style( 'attire-main' ); //wp_register_style( 'font-awesome', ATTIRE_TEMPLATE_URL . '/fonts/fontawesome/css/all.min.css' ); //wp_enqueue_style( 'font-awesome' ); wp_register_style( 'attire-google-fonts', $cssimport, array(), null ); wp_enqueue_style( 'attire-google-fonts' ); wp_register_style( 'attire-woocommerce', ATTIRE_TEMPLATE_URL . '/css/woocommerce.css' ); if ( class_exists( 'WooCommerce' ) ) wp_enqueue_style( 'attire-woocommerce' ); wp_register_style( 'attire', ATTIRE_TEMPLATE_URL . '/css/attire.css' ); wp_enqueue_style( 'attire' ); wp_register_script( 'popper', ATTIRE_TEMPLATE_URL . '/bootstrap/js/popper.min.js', array(), null, true ); wp_enqueue_script( 'popper' ); wp_register_script( 'bootstrap', ATTIRE_TEMPLATE_URL . '/bootstrap/js/bootstrap.min.js', array( 'jquery', 'popper' ), null, true ); wp_enqueue_script( 'bootstrap' ); wp_register_script( 'attire-site', ATTIRE_TEMPLATE_URL . '/js/site.js', array( 'jquery' ), null, true ); wp_enqueue_script( 'attire-site' ); wp_register_script( 'comment-reply', '', array(), null, true ); wp_enqueue_script( 'comment-reply' ); wp_localize_script( 'attire-site', 'sitejs_local_obj', array( 'home_url' => esc_url( home_url( '/' ) ) ) ); } function sanitize_hex_color_front( $color ) { if ( '' === $color ) { return ''; } // 3 or 6 hex digits, or the empty string. if ( preg_match( '|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) ) { return $color; } } /** * @usage: Register nav menus */ function RegisterNavMenus() { register_nav_menus( array( 'primary' => __( 'Top Menu', 'attire' ) ) ); register_nav_menus( array( 'footer_menu' => __( 'Footer Menu', 'attire' ) ) ); } /** * @usage Post Comments * * @param $comment * @param $args * @param $depth */ public static function Comment( $comment, $args, $depth ) { switch ( $comment->comment_type ) : case 'pingback' : case 'trackback' : ?>
  • Pingback: ', '' ); ?>

  • id="li-comment-">
    <?php esc_attr_e( 'Commenter\'s Avatar', 'attire' ); ?>
    %s', get_comment_author_link() ) ?>
    comment_approved == '0' ) : ?>
    ' . esc_html__( 'Edit', 'attire' ), ' ' ); ?> ' . esc_html__( 'Reply', 'attire' ), 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ) ?>
    LoadTextDoamin(); add_theme_support( 'customize-selective-refresh-widgets' ); add_theme_support( 'post-thumbnails' ); add_theme_support( 'title-tag' ); add_theme_support( 'automatic-feed-links' ); add_theme_support( 'custom-background' ); add_post_type_support( 'page', 'excerpt' ); add_theme_support( 'woocommerce' ); add_theme_support( 'wc-product-gallery-zoom' ); add_theme_support( 'wc-product-gallery-lightbox' ); add_theme_support( 'wc-product-gallery-slider' ); $args = array( 'default-image' => '', 'default-text-color' => '000', 'width' => 1000, 'height' => 250, 'flex-width' => true, 'flex-height' => true, ); add_theme_support( 'custom-header', $args ); add_theme_support( 'custom-logo' ); add_image_size( 'attire-card-image', 600, 400, array( 'center', 'top' ) ); if ( ! get_option( 'attire_options' ) ) { add_option( 'attire_options', $this->GetAttireDefaults() ); } } public function GetAttireDefaults() { $this->attire_defaults = array( 'footer_widget_number' => '3', 'copyright_info' => '©' . esc_attr__( 'Copyright ', 'attire' ) . date( 'Y' ) . '.', 'layout_front_page' => 'no-sidebar', 'front_page_ls' => 'left', 'front_page_ls_width' => '3', 'front_page_rs' => 'right', 'front_page_rs_width' => '3', 'layout_default_post' => 'right-sidebar-1', 'default_post_ls' => 'left', 'default_post_ls_width' => '3', 'default_post_rs' => 'right', 'default_post_rs_width' => '3', 'layout_default_page' => 'no-sidebar', 'default_page_ls' => 'left', 'default_page_ls_width' => '3', 'default_page_rs' => 'right', 'default_page_rs_width' => '3', 'layout_archive_page' => 'no-sidebar', 'archive_page_ls' => 'left', 'archive_page_ls_width' => '3', 'archive_page_rs' => 'right', 'archive_page_rs_width' => '3', 'nav_header' => 'header-1', 'footer_style' => 'footer4', 'main_layout_type' => 'container-fluid', 'main_layout_width' => '1300', 'header_content_layout_type' => 'container', 'body_content_layout_type' => 'container', 'footer_widget_content_layout_type' => 'container', 'footer_content_layout_type' => 'container', 'heading_font' => 'Rubik:400,400i,500,700', 'heading_font_size' => '25', 'heading_font_weight' => '700', 'body_font' => 'Rubik:400,400i,500,700', 'body_font_size' => '14', 'body_font_weight' => '400', 'widget_title_font' => 'Rubik:400,400i,500,700', 'widget_title_font_size' => '14', 'widget_title_font_weight' => '500', 'widget_content_font' => 'Rubik:400,400i,500,700', 'widget_content_font_size' => '13', 'widget_content_font_weight' => '400', 'menu_top_font' => 'Rubik:400,400i,500,700', 'menu_top_font_size' => '13', 'menu_top_font_weight' => '400', 'menu_dropdown_font' => 'Rubik:400,400i,500,700', 'menu_dropdown_font_size' => '13', 'menu_dropdown_font_weight' => '400', 'site_header_bg_color_left' => '#fafafa', 'site_header_bg_color_right' => '#fafafa', 'site_header_bg_grad_angle' => '45', 'site_title_text_color' => '#444444', 'site_description_text_color' => '#666666', 'site_footer_bg_color' => '#435ec4', 'site_footer_title_text_color' => '#ffffff', 'menu_top_font_color' => '#ffffff', 'main_nav_bg' => '#435ec4', 'menuhbg_color' => '#ffffff', 'menuht_color' => '#000000', 'menu_dropdown_bg_color' => '#ffffff', 'menu_dropdown_font_color' => '#000000', 'menu_dropdown_hover_bg' => '#435ec4', 'menu_dropdown_hover_font_color' => '#ffffff', 'footer_nav_top_font_color' => '#a2b4f9', 'footer_nav_bg' => '#435ec4', 'footer_nav_hbg' => '#ffffff', 'footer_nav_ht_color' => '#ffffff', 'footer_nav_dropdown_font_color' => '#ffffff', 'footer_nav_dropdown_hover_bg' => '#435ec4', 'footer_nav_dropdown_hover_font_color' => '#ffffff', 'body_bg_color' => '#fafafa', 'a_color' => '#435ec4', 'ah_color' => '#777777', 'header_color' => '#333333', 'body_color' => '#444444', 'widget_title_font_color' => '#ffffff', 'widget_content_font_color' => '#444444', 'widget_bg_color' => '#ffffff', 'footer_widget_title_font_color' => '#000000', 'footer_widget_content_font_color' => '#000000', 'footer_widget_bg_color' => '#D4D4D6', 'attire_archive_page_post_view' => 'excerpt', 'attire_read_more_text' => 'read more...', 'attire_single_post_post_navigation' => 'show', 'attire_single_post_meta_position' => 'after-title', 'container_width' => '1100', 'copyright_info_visibility' => 'show', 'attire_search_form_visibility' => 'show', 'attire_back_to_top_visibility' => 'show', 'attire_nav_behavior' => 'sticky', 'site_logo_height' => '32', 'site_logo_footer_height' => '32' ); return $this->attire_defaults; } static function comment_form( $args = array(), $post_id = null ) { if ( null === $post_id ) { $post_id = get_the_ID(); } // Exit the function when comments for the post are closed. if ( ! comments_open( $post_id ) ) { /** * Fires after the comment form if comments are closed. * * @since 3.0.0 */ do_action( 'comment_form_comments_closed' ); return; } $commenter = wp_get_current_commenter(); $user = wp_get_current_user(); $user_identity = $user->exists() ? $user->display_name : ''; $args = wp_parse_args( $args ); if ( ! isset( $args['format'] ) ) { $args['format'] = current_theme_supports( 'html5', 'comment-form' ) ? 'html5' : 'xhtml'; } $req = get_option( 'require_name_email' ); $html_req = ( $req ? " required='required'" : '' ); $html5 = 'html5' === $args['format']; $fields = array( 'author' => sprintf( '

    %s %s

    ', sprintf( '', __( 'Name' ), ( $req ? ' *' : '' ) ), sprintf( '', esc_attr( $commenter['comment_author'] ), $html_req ) ), 'email' => sprintf( '

    %s %s

    ', sprintf( '', __( 'Email' ), ( $req ? ' *' : '' ) ), sprintf( '', ( $html5 ? 'type="email"' : 'type="text"' ), esc_attr( $commenter['comment_author_email'] ), $html_req ) ), 'url' => sprintf( '

    %s %s

    ', sprintf( '', __( 'Website' ) ), sprintf( '', ( $html5 ? 'type="url"' : 'type="text"' ), esc_attr( $commenter['comment_author_url'] ) ) ), ); if ( has_action( 'set_comment_cookies', 'wp_set_comment_cookies' ) && get_option( 'show_comments_cookies_opt_in' ) ) { $consent = empty( $commenter['comment_author_email'] ) ? '' : ' checked="checked"'; $fields['cookies'] = sprintf( '', sprintf( '', $consent ), sprintf( '', __( 'Save my name, email, and website in this browser for the next time I comment.' ) ) ); // Ensure that the passed fields include cookies consent. if ( isset( $args['fields'] ) && ! isset( $args['fields']['cookies'] ) ) { $args['fields']['cookies'] = $fields['cookies']; } } $required_text = sprintf( /* translators: %s: Asterisk symbol (*). */ ' ' . __( 'Required fields are marked %s' ), '*' ); /** * Filters the default comment form fields. * * @since 3.0.0 * * @param string[] $fields Array of the default comment fields. */ $fields = apply_filters( 'comment_form_default_fields', $fields ); $defaults = array( 'fields' => $fields, 'comment_field' => sprintf( '

    %s %s

    ', sprintf( '', _x( 'Comment', 'noun' ) ), '' ), 'must_log_in' => sprintf( '

    %s

    ', sprintf( /* translators: %s: Login URL. */ __( 'You must be logged in to post a comment.' ), /** This filter is documented in wp-includes/link-template.php */ wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ), $post_id ) ) ) ), 'logged_in_as' => sprintf( '

    %s

    ', sprintf( /* translators: 1: Edit user link, 2: Accessibility text, 3: User name, 4: Logout URL. */ __( 'Logged in as %3$s. Log out?' ), get_edit_user_link(), /* translators: %s: User name. */ esc_attr( sprintf( __( 'Logged in as %s. Edit your profile.' ), $user_identity ) ), $user_identity, /** This filter is documented in wp-includes/link-template.php */ wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ), $post_id ) ) ) ), 'comment_notes_before' => sprintf( '

    %s%s

    ', sprintf( '%s', __( 'Your email address will not be published.' ) ), ( $req ? $required_text : '' ) ), 'comment_notes_after' => '', 'action' => site_url( '/wp-comments-post.php' ), 'id_form' => 'commentform', 'id_submit' => 'submit', 'class_form' => 'comment-form', 'class_submit' => 'btn btn-primary btn-lg', 'name_submit' => 'submit', 'title_reply' => __( 'Leave a Reply' ), /* translators: %s: Author of the comment being replied to. */ 'title_reply_to' => __( 'Leave a Reply to %s' ), 'title_reply_before' => '

    ', 'title_reply_after' => '

    ', 'cancel_reply_before' => ' ', 'cancel_reply_after' => '', 'cancel_reply_link' => __( 'Cancel reply' ), 'label_submit' => __( 'Post Comment' ), 'submit_button' => '', 'submit_field' => '%1$s %2$s', 'format' => 'xhtml', ); /** * Filters the comment form default arguments. * * Use {@see 'comment_form_default_fields'} to filter the comment fields. * * @since 3.0.0 * * @param array $defaults The default comment form arguments. */ $args = wp_parse_args( $args, apply_filters( 'comment_form_defaults', $defaults ) ); // Ensure that the filtered args contain all required default values. $args = array_merge( $defaults, $args ); // Remove `aria-describedby` from the email field if there's no associated description. if ( isset( $args['fields']['email'] ) && false === strpos( $args['comment_notes_before'], 'id="email-notes"' ) ) { $args['fields']['email'] = str_replace( ' aria-describedby="email-notes"', '', $args['fields']['email'] ); } /** * Fires before the comment form. * * @since 3.0.0 */ do_action( 'comment_form_before' ); ?>
    ', esc_url( $args['action'] ), esc_attr( $args['id_form'] ), esc_attr( $args['class_form'] ), ( $html5 ? ' novalidate' : '' ) ); /** * Fires at the top of the comment form, inside the form tag. * * @since 3.0.0 */ do_action( 'comment_form_top' ); if ( is_user_logged_in() ) : /** * Filters the 'logged in' message for the comment form for display. * * @since 3.0.0 * * @param string $args_logged_in The logged-in-as HTML-formatted message. * @param array $commenter An array containing the comment author's * username, email, and URL. * @param string $user_identity If the commenter is a registered user, * the display name, blank otherwise. */ echo apply_filters( 'comment_form_logged_in', $args['logged_in_as'], $commenter, $user_identity ); /** * Fires after the is_user_logged_in() check in the comment form. * * @since 3.0.0 * * @param array $commenter An array containing the comment author's * username, email, and URL. * @param string $user_identity If the commenter is a registered user, * the display name, blank otherwise. */ do_action( 'comment_form_logged_in_after', $commenter, $user_identity ); else : echo $args['comment_notes_before']; endif; // Prepare an array of all fields, including the textarea. $comment_fields = array( 'comment' => $args['comment_field'] ) + (array) $args['fields']; /** * Filters the comment form fields, including the textarea. * * @since 4.4.0 * * @param array $comment_fields The comment fields. */ $comment_fields = apply_filters( 'comment_form_fields', $comment_fields ); // Get an array of field names, excluding the textarea. $comment_field_keys = array_diff( array_keys( $comment_fields ), array( 'comment' ) ); // Get the first and the last field name, excluding the textarea. $first_field = reset( $comment_field_keys ); $last_field = end( $comment_field_keys ); echo "
    "; foreach ( $comment_fields as $name => $field ) { if ( 'comment' === $name ) { echo "
    "; /** * Filters the content of the comment textarea field for display. * * @since 3.0.0 * * @param string $args_comment_field The content of the comment textarea field. */ echo apply_filters( 'comment_form_field_comment', $field ); echo $args['comment_notes_after']; echo "
    "; } elseif ( ! is_user_logged_in() ) { echo "
    "; if ( $first_field === $name ) { /** * Fires before the comment fields in the comment form, excluding the textarea. * * @since 3.0.0 */ do_action( 'comment_form_before_fields' ); } /** * Filters a comment form field for display. * * The dynamic portion of the filter hook, `$name`, refers to the name * of the comment form field. Such as 'author', 'email', or 'url'. * * @since 3.0.0 * * @param string $field The HTML-formatted output of the comment form field. */ echo apply_filters( "comment_form_field_{$name}", $field ) . "\n"; if ( $last_field === $name ) { /** * Fires after the comment fields in the comment form, excluding the textarea. * * @since 3.0.0 */ do_action( 'comment_form_after_fields' ); } echo "
    "; } } echo "
    "; /** * Fires at the bottom of the comment form, inside the closing form tag. * * @since 1.5.0 * * @param int $post_id The post ID. */ do_action( 'comment_form', $post_id ); echo ''; endif; ?>