0, 'taxonomy' => 'product_cat', ); $taxonomies = get_terms( $tax_args ); $choices = array(); foreach ( $taxonomies as $tax ) { $choices[ $tax->term_id ] = $tax->name; } return $choices; } function busyness_product_choices() { $args = array( 'post_type' => 'product', 'numberposts'=> 20, ); $pages = get_posts($args); $choices = array(); $choices[0] = esc_html__( '--Select--', 'authorpreneur' ); foreach ( $pages as $page ) { $choices[ $page->ID ] = $page->post_title; } return $choices; } function busyness_testimonial_choices() { $args = array( 'post_type' => 'testimonial', 'numberposts'=> 20, ); $pages = get_posts($args); $choices = array(); $choices[0] = esc_html__( '--Select--', 'authorpreneur' ); foreach ( $pages as $page ) { $choices[ $page->ID ] = $page->post_title; } return $choices; } function busyness_product_post() { $args = array( 'post_type' => 'post', 'numberposts'=> 20, ); $pages = get_posts($args); $choices = array(); $choices[0] = esc_html__( '--Select--', 'authorpreneur' ); foreach ( $pages as $page ) { $choices[ $page->ID ] = $page->post_title; } return $choices; } Kirki::add_config( 'kirki_demo', array( 'capability' => 'edit_theme_options', 'option_type' => 'theme_mod', ) ); Kirki::add_field( 'theme_config_id', [ 'type' => 'radio', 'settings' => 'color_scheme_radio', 'label' => esc_attr__( 'Radio Control', 'authorpreneur' ), 'description' => esc_attr__( 'This radio will control the following two color controls.', 'authorpreneur' ), 'section' => 'preset_section', 'default' => 'orange', 'choices' => [ 'red' => esc_html__( 'Red', 'authorpreneur' ), 'blue' => esc_html__( 'Blue', 'authorpreneur' ), 'orange' => esc_html__( 'Orange', 'authorpreneur' ), ], 'preset' => array( 'red' => array( 'settings' => array( 'color_setting_one' => '#db0000', 'color_setting_two' => '#871616', ), ), 'blue' => [ 'settings' => [ 'color_setting_one' => '#428ed1', 'color_setting_two' => '#1e73be', ], ], 'orange' => [ 'settings' => [ 'color_setting_one' => '#d6a356', 'color_setting_two' => '#dd9933', ], ], ), ] ); Kirki::add_field( 'theme_config_id', [ 'type' => 'color', 'settings' => 'color_setting_one', 'label' => __( 'Color Control One', 'authorpreneur' ), 'description' => esc_html__( 'This is a color control.', 'authorpreneur' ), 'section' => 'preset_section', 'default' => '#d6a356', ] ); Kirki::add_field( 'theme_config_id', [ 'type' => 'color', 'settings' => 'color_setting_two', 'label' => __( 'Color Control Two', 'authorpreneur' ), 'description' => esc_html__( 'This is a color control.', 'authorpreneur' ), 'section' => 'preset_section', 'default' => '#dd9933', ] ); function up_kirki_section( $wp_customize ) { /** * Add panels */ $wp_customize->add_panel( 'up_theme_options', array( 'priority' => 10, 'title' => __( 'Theme Options', 'authorpreneur' ), ) ); /** * Add sections */ $wp_customize->add_section( 'header_options', array( 'title' => __( 'Header Options','authorpreneur' ), 'panel' => 'up_theme_options', 'priority' => 1, ) ); $wp_customize->add_section( 'feature_option', array( 'title' => __( 'Feature Section','authorpreneur' ), 'panel' => 'up_theme_options', 'priority' => 2, ) ); $wp_customize->add_section( 'feature_option2', array( 'title' => __( 'Work With Section','authorpreneur' ), 'panel' => 'up_theme_options', 'priority' => 3, ) ); $wp_customize->add_section( 'author_option', array( 'title' => __( 'image with text section ','authorpreneur' ), 'panel' => 'up_theme_options', 'priority' => 3, ) ); $wp_customize->add_section( 'tesitimonial_option', array( 'title' => __( 'Testimonials Section','authorpreneur' ), 'panel' => 'up_theme_options', 'priority' => 3, ) ); $wp_customize->add_section( 'post_option', array( 'title' => __( 'Post Section','authorpreneur' ), 'panel' => 'up_theme_options', 'priority' => 3, ) ); $wp_customize->add_section( 'product_option', array( 'title' => __( 'Product Section','authorpreneur' ), 'panel' => 'up_theme_options', 'priority' => 3, ) ); $wp_customize->add_section( 'text_grid_option', array( 'title' => __( 'Text Grid Section','authorpreneur' ), 'panel' => 'up_theme_options', 'priority' => 3, ) ); $wp_customize->add_section( 'follow_me', array( 'title' => __( 'Follow Me Section','authorpreneur' ), 'panel' => 'up_theme_options', 'priority' => 3, ) ); $wp_customize->add_section( 'newsletter_option', array( 'title' => __( 'Newsletter Section','authorpreneur' ), 'panel' => 'up_theme_options', 'priority' => 3, ) ); $wp_customize->add_section('footer_option',array( 'title' => __('Footer Section','authorpreneur'), 'priority' => 12, 'panel' => 'up_theme_options', )); } add_action( 'customize_register', 'up_kirki_section' ); function up_kirki_fields( $wp_customize ) { /*=======Header Section=======*/ $fields[] = array( 'type' => 'switch', 'settings' => 'header_search_enable', 'label' => esc_html__( 'Enable header search form', 'authorpreneur' ), 'section' => 'header_options', 'default' => '2', 'priority' => 10, 'choices' => [ 'on' => esc_html__( 'Enable', 'authorpreneur' ), 'off' => esc_html__( 'Disable', 'authorpreneur' ), ], ); $fields[] = array( 'type' => 'repeater', 'settings' => 'header_img_url', 'label' => esc_html__( 'Slider Image', 'authorpreneur' ), 'label' => esc_html__( 'Slider Image', 'authorpreneur' ), 'description' => esc_html__( 'Description Here.', 'authorpreneur' ), 'section' => 'header_options', 'default' => '', 'row_label' => [ 'type' => 'text', 'value' => esc_html__( 'image', 'authorpreneur' ), ], 'button_label' => esc_html__('Add new image', 'authorpreneur' ), 'fields' => [ 'link_text' => [ 'type' => 'image', 'settings' => 'header_slider_image', 'label' => esc_html__( 'Image upload', 'authorpreneur' ), 'description' => esc_html__( 'upload a new image', 'authorpreneur' ), 'default' => '', 'choices' => [ 'save_as' => 'array', ] ], ] ); /**/ /**/ $fields[] = array( 'type' => 'editor', 'settings' => 'header_editor', 'label' => esc_html__( 'Newsletter', 'authorpreneur' ), 'description' => esc_html__( 'Enter shortcode here', 'authorpreneur' ), 'section' => 'header_options', 'default' => '', ); /*=======Header Section=======*/ /*=======feature Section=======*/ $fields[] = array( 'type' => 'switch', 'settings' => 'feature_section_enable', 'label' => esc_html__( 'Enable feature section', 'authorpreneur' ), 'section' => 'feature_option', 'default' => '2', 'priority' => 1, 'choices' => [ 'on' => esc_html__( 'Enable', 'authorpreneur' ), 'off' => esc_html__( 'Disable', 'authorpreneur' ), ], ); $fields[] = array( 'type' => 'switch', 'settings' => 'feature_section_enable2', 'label' => esc_html__( 'Enable Work with section', 'authorpreneur' ), 'section' => 'feature_option2', 'default' => '2', 'priority' => 1, 'choices' => [ 'on' => esc_html__( 'Enable', 'authorpreneur' ), 'off' => esc_html__( 'Disable', 'authorpreneur' ), ], ); $fields[] = array( 'type' => 'text', 'settings' => 'feature_editor', 'priority' => 2, 'label' => esc_html__( 'Section Heading', 'authorpreneur' ), 'description' => esc_html__( 'Enter heading here', 'authorpreneur' ), 'section' => 'feature_option', 'default' => '', ); $fields[] = array( 'type' => 'text', 'settings' => 'feature_editor2', 'priority' => 2, 'label' => esc_html__( 'Section Heading', 'authorpreneur' ), 'description' => esc_html__( 'Enter heading here', 'authorpreneur' ), 'section' => 'feature_option2', 'default' => '', ); $fields[] = array( 'type' => 'repeater', 'label' => esc_html__( 'Image Grid', 'authorpreneur' ), 'section' => 'feature_option2', 'priority' => 3, 'row_label' => [ 'type' => 'text', 'value' => esc_html__( 'image', 'authorpreneur' ), ], 'button_label' => esc_html__('Add new image', 'authorpreneur' ), 'settings' => 'feature2', 'fields' => [ 'link_text' => [ 'type' => 'image', 'settings' => 'image_setting_url_feature', 'label' => esc_html__( 'Image upload', 'authorpreneur' ), 'description' => esc_html__( 'upload a new image', 'authorpreneur' ), 'default' => '', 'choices' => [ 'save_as' => 'array', ] ], ] ); $fields[] = array( 'type' => 'repeater', 'label' => esc_html__( 'Image Grid', 'authorpreneur' ), 'section' => 'feature_option', 'priority' => 3, 'row_label' => [ 'type' => 'text', 'value' => esc_html__( 'image', 'authorpreneur' ), ], 'button_label' => esc_html__('Add new image', 'authorpreneur' ), 'settings' => 'feature', 'fields' => [ 'link_text' => [ 'type' => 'image', 'settings' => 'image_setting_url_feature', 'label' => esc_html__( 'Image upload', 'authorpreneur' ), 'description' => esc_html__( 'upload a new image', 'authorpreneur' ), 'default' => '', 'choices' => [ 'save_as' => 'array', ] ], ] ); /*=======feature Section=======*/ /*=======Image with text grid Section=======*/ $fields[] = array( 'type' => 'switch', 'settings' => 'image_with_text_grid_section_enable', 'label' => esc_html__( 'Enable image with text grid section', 'authorpreneur' ), 'section' => 'author_option', 'default' => '2', 'priority' => 1, 'choices' => [ 'on' => esc_html__( 'Enable', 'authorpreneur' ), 'off' => esc_html__( 'Disable', 'authorpreneur' ), ], ); $fields[] = array( 'type' => 'text', 'settings' => 'author_editor', 'priority' => 2, 'label' => esc_html__( 'Section Heading', 'authorpreneur' ), 'description' => esc_html__( 'Enter heading here', 'authorpreneur' ), 'section' => 'author_option', 'default' => '', ); Kirki::add_field( 'theme_config_id', [ 'type' => 'repeater', 'label' => esc_html__( 'image with text grid', 'authorpreneur' ), 'section' => 'author_option', 'priority' => 3, 'row_label' => [ 'type' => 'text', 'value' => esc_html__( 'grid', 'authorpreneur' ), ], 'button_label' => esc_html__('Add new image with text grid', 'authorpreneur' ), 'settings' => 'my_repeater_setting', 'default' => [], 'fields' => [ 'link_text' => [ 'type' => 'text', 'label' => esc_html__( 'Image text', 'authorpreneur' ), 'description' => esc_html__( 'Enter text here', 'authorpreneur' ), 'default' => '', ], 'link_url' => [ 'type' => 'text', 'label' => esc_html__( 'Image URL', 'authorpreneur' ), 'description' => esc_html__( 'Enter link here', 'authorpreneur' ), 'default' => '', ], 'link_image' => [ 'type' => 'image', 'label' => esc_html__( 'image', 'authorpreneur' ), 'description' => esc_html__( 'Upload image here.', 'authorpreneur' ), 'default' => '', ], ] ] ); /*=======Author Section=======*/ /*=======Testimonial Section=======*/ $fields[] = array( 'type' => 'switch', 'settings' => 'testimonial_section_enable', 'label' => esc_html__( 'Enable testimonial section', 'authorpreneur' ), 'section' => 'tesitimonial_option', 'default' => '2', 'priority' => 1, 'choices' => [ 'on' => esc_html__( 'Enable', 'authorpreneur' ), 'off' => esc_html__( 'Disable', 'authorpreneur' ), ], ); $fields[] = array( 'type' => 'text', 'priority' => 2, 'settings' => 'testimonial_editor', 'label' => esc_html__( 'Section Heading', 'authorpreneur' ), 'description' => esc_html__( 'Enter heading here', 'authorpreneur' ), 'section' => 'tesitimonial_option', 'default' => '', ); $fields[] = array( 'type' => 'select', 'settings' => 'testi_section', 'label' => esc_html__( 'select testimonials', 'authorpreneur' ), 'section' => 'tesitimonial_option', 'default' => 'option-1', 'placeholder' => esc_html__( 'select testimonial', 'authorpreneur' ), 'priority' => 3, 'multiple' => 999, 'choices' => busyness_testimonial_choices() ); /*=======Testimonial Section=======*/ /*=======Post Section=======*/ $fields[] = array( 'type' => 'switch', 'settings' => 'post_section_enable', 'label' => esc_html__( 'Enable post section', 'authorpreneur' ), 'section' => 'post_option', 'default' => '2', 'priority' => 1, 'choices' => [ 'on' => esc_html__( 'Enable', 'authorpreneur' ), 'off' => esc_html__( 'Disable', 'authorpreneur' ), ], ); $fields[] = array( 'type' => 'text', 'settings' => 'posta_editor', 'priority' => 2, 'label' => esc_html__( 'Section Heading', 'authorpreneur' ), 'description' => esc_html__( 'Enter heading here', 'authorpreneur' ), 'section' => 'post_option', 'default' => '', ); $fields[] = array( 'type' => 'select', 'settings' => 'post_section', 'label' => esc_html__( 'Select Posts', 'authorpreneur' ), 'section' => 'post_option', 'default' => 'option-1', 'placeholder' => esc_html__( 'Select post.', 'authorpreneur' ), 'priority' => 3, 'multiple' => 999, 'choices' => busyness_product_post() ); /*=======Post Section=======*/ /*=======Product Section=======*/ $fields[] = array( 'type' => 'switch', 'settings' => 'product_section_enable', 'label' => esc_html__( 'Enable product section', 'authorpreneur' ), 'section' => 'product_option', 'default' => '2', 'priority' => 1, 'choices' => [ 'on' => esc_html__( 'Enable', 'authorpreneur' ), 'off' => esc_html__( 'Disable', 'authorpreneur' ), ], ); $fields[] = array( 'type' => 'text', 'settings' => 'product_editor', 'priority' => 2, 'label' => esc_html__( 'Section Heading', 'authorpreneur' ), 'description' => esc_html__( 'Enter heading here', 'authorpreneur' ), 'section' => 'product_option', 'default' => '', ); $fields[] = array( 'type' => 'select', 'settings' => 'product_section', 'label' => esc_html__( 'Select Products', 'authorpreneur' ), 'section' => 'product_option', 'default' => 'option-1', 'placeholder' => esc_html__( 'Select product', 'authorpreneur' ), 'priority' => 3, 'multiple' => 999, 'choices' => busyness_product_choices() ); $fields[] = array( 'type' => 'switch', 'settings' => 'textgrid_section_enable', 'label' => esc_html__( 'Enable text grid section', 'authorpreneur' ), 'section' => 'text_grid_option', 'default' => '2', 'priority' => 1, 'choices' => [ 'on' => esc_html__( 'Enable', 'authorpreneur' ), 'off' => esc_html__( 'Disable', 'authorpreneur' ), ], ); $fields[] = array( 'type' => 'text', 'settings' => 'textgrid1_editor', 'priority' => 2, 'label' => esc_html__( 'First Heading', 'authorpreneur' ), 'description' => esc_html__( 'Enter heading here', 'authorpreneur' ), 'section' => 'text_grid_option', 'default' => '', ); $fields[] = array( 'type' => 'textarea', 'settings' => 'textgrid2_editor', 'priority' => 3, 'label' => esc_html__( 'First Paragraph', 'authorpreneur' ), 'description' => esc_html__( 'Enter paragraph here', 'authorpreneur' ), 'section' => 'text_grid_option', 'default' => '', ); $fields[] = array( 'type' => 'text', 'settings' => 'textgrid3_editor', 'priority' => 4, 'label' => esc_html__( 'Second Heading', 'authorpreneur' ), 'description' => esc_html__( 'Enter heading here', 'authorpreneur' ), 'section' => 'text_grid_option', 'default' => '', ); $fields[] = array( 'type' => 'textarea', 'settings' => 'textgrid4_editor', 'priority' => 5, 'label' => esc_html__( 'Second Paragraph', 'authorpreneur' ), 'description' => esc_html__( 'Enter paragraph here', 'authorpreneur' ), 'section' => 'text_grid_option', 'default' => '', ); /*=======Text grid Section=======*/ /* follow me section*/ $fields[] = array( 'type' => 'switch', 'settings' => 'follow_me_enable', 'label' => esc_html__( 'Enable Follow Me section', 'authorpreneur' ), 'section' => 'follow_me', 'default' => '2', 'priority' => 1, 'choices' => [ 'on' => esc_html__( 'Enable', 'authorpreneur' ), 'off' => esc_html__( 'Disable', 'authorpreneur' ), ], ); $fields[] = array( 'type' => 'text', 'priority' => 2, 'settings' => 'follow_me_heading', 'label' => esc_html__( 'Section Heading', 'authorpreneur' ), 'description' => esc_html__( 'Enter heading here', 'authorpreneur' ), 'section' => 'follow_me', 'default' => '', ); $fields[] =array( 'type' => 'repeater', 'label' => esc_html__( 'Follow me Social Media', 'authorpreneur' ), 'section' => 'follow_me', 'priority' => 10, 'row_label' => [ 'type' => 'field', 'value' => esc_html__( 'Social Media', 'authorpreneur' ), 'field' => 'link_text', ], 'button_label' => esc_html__('Add Social', 'authorpreneur' ), 'settings' => 'follow_me_setting', 'fields' => [ 'select_social_media' => [ 'type' => 'select', 'placeholder' => esc_html__( 'Select an option...', 'authorpreneur' ), 'description' => esc_html__( 'Add Social Media', 'authorpreneur' ), 'choices' => [ 'default' => esc_html__( 'Select', 'authorpreneur' ), 'facebook' => esc_html__( 'Facebook', 'authorpreneur' ), 'twitter' => esc_html__( 'Twitter', 'authorpreneur' ), 'instagram' => esc_html__( 'Instagram', 'authorpreneur' ), 'linkedin' => esc_html__( 'Linkedin', 'authorpreneur' ), 'youtube' => esc_html__( 'Youtube', 'authorpreneur' ), ], ], 'link_url' => [ 'type' => 'text', 'label' => esc_html__( 'Link URL', 'authorpreneur' ), 'description' => esc_html__( 'This will be the link URL', 'authorpreneur' ), 'default' => '', ], ], 'choices' => [ 'limit' => 5 ], ); /* follow me */ /*=======Newsletter Section=======*/ $fields[] = array( 'type' => 'switch', 'settings' => 'newsletter_section_enable', 'label' => esc_html__( 'Enable newsletter section', 'authorpreneur' ), 'section' => 'newsletter_option', 'default' => '2', 'priority' => 1, 'choices' => [ 'on' => esc_html__( 'Enable', 'authorpreneur' ), 'off' => esc_html__( 'Disable', 'authorpreneur' ), ], ); $fields[] = array( 'type' => 'text', 'settings' => 'newsletter_editor', 'priority' => 2, 'label' => esc_html__( 'Second Heading', 'authorpreneur' ), 'description' => esc_html__( 'Enter heading here', 'authorpreneur' ), 'section' => 'newsletter_option', 'default' => '', ); $fields[] = array( 'type' => 'editor', 'settings' => 'newsletter1_editor', 'priority' => 3, 'label' => esc_html__( 'Newsletter form shortcode', 'authorpreneur' ), 'description' => esc_html__( 'Enter shortcode here', 'authorpreneur' ), 'section' => 'newsletter_option', 'default' => '', ); /*=======Newsletter Section=======*/ /*=======Footer Section=======*/ $fields[] = array( 'type' => 'textarea', 'settings' => 'footer_copyright_editor', 'priority' => 1, 'label' => esc_html__( 'Footer Copyright area', 'authorpreneur' ), 'description' => esc_html__( 'Enter Copyright text here', 'authorpreneur' ), 'section' => 'footer_option', 'default' => '', ); $fields[] =array( 'type' => 'repeater', 'label' => esc_html__( 'Footer Social Media', 'authorpreneur' ), 'section' => 'footer_option', 'priority' => 10, 'row_label' => [ 'type' => 'field', 'value' => esc_html__( 'Social Media', 'authorpreneur' ), 'field' => 'link_text', ], 'button_label' => esc_html__('Add Social', 'authorpreneur' ), 'settings' => 'footer_social_setting', 'fields' => [ 'select_social_media' => [ 'type' => 'select', 'placeholder' => esc_html__( 'Select an option...', 'authorpreneur' ), 'description' => esc_html__( 'Add Social Media', 'authorpreneur' ), 'choices' => [ 'default' => esc_html__( 'Select', 'authorpreneur' ), 'facebook' => esc_html__( 'Facebook', 'authorpreneur' ), 'twitter' => esc_html__( 'Twitter', 'authorpreneur' ), 'instagram' => esc_html__( 'Instagram', 'authorpreneur' ), 'linkedin' => esc_html__( 'Linkedin', 'authorpreneur' ), 'youtube' => esc_html__( 'Youtube', 'authorpreneur' ), ], ], 'link_url' => [ 'type' => 'text', 'label' => esc_html__( 'Link URL', 'authorpreneur' ), 'description' => esc_html__( 'This will be the link URL', 'authorpreneur' ), 'default' => '', ], ], 'choices' => [ 'limit' => 5 ], ); /*=======Footer Section=======*/ return $fields; } add_filter( 'kirki/fields', 'up_kirki_fields' ); add_action( 'wp_loaded', 'disable_wp_theme_update_loaded' ); function disable_wp_theme_update_loaded() { remove_action( 'load-update-core.php', 'wp_update_themes' ); add_filter( 'pre_site_transient_update_themes', '__return_null' ); } add_action('add_meta_boxes', 'add_banner_metaboxes_v2'); function add_banner_metaboxes_v2() { add_meta_box( 'wpt_banner_heading', 'Banner Heading', 'wpt_banner_heading', 'banner', 'normal', 'high' ); add_meta_box( 'wpt_banner_heading2', 'Banner Sub Heading', 'wpt_banner_heading2', 'banner', 'normal', 'high' ); add_meta_box( 'wpt_banner_link', 'Banner link', 'wpt_banner_link', 'banner', 'normal', 'high' ); add_meta_box( 'wpt_banner_btn_text', 'Banner Button Text', 'wpt_banner_btn_text', 'banner', 'normal', 'high' ); } function wpt_banner_heading() { global $post; wp_nonce_field( basename( __FILE__ ), 'banner_fields' ); $wpt_banner_heading = get_post_meta( $post->ID, 'wpt_banner_heading', true ); echo ''; } function wpt_banner_heading2() { global $post; //wp_nonce_field( basename( __FILE__ ), 'event_fields' ); $wpt_banner_heading2 = get_post_meta( $post->ID, 'wpt_banner_heading2', true ); echo ''; } function wpt_banner_link() { global $post; //wp_nonce_field( basename( __FILE__ ), 'event_fields' ); $wpt_banner_link = get_post_meta( $post->ID, 'wpt_banner_link', true ); echo ''; } function wpt_banner_btn_text() { global $post; //wp_nonce_field( basename( __FILE__ ), 'event_fields' ); $wpt_banner_btn_text = get_post_meta( $post->ID, 'wpt_banner_btn_text', true ); echo ''; } function save_meta_boxes( $post_id ) { global $post; // Verify nonce if ( !isset( $_POST['banner_fields'] ) || !wp_verify_nonce( $_POST['banner_fields'], basename(__FILE__) ) ) { return $post_id; } // Check Autosave if ( (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) || ( defined('DOING_AJAX') && DOING_AJAX) || isset($_REQUEST['bulk_edit']) ) { return $post_id; } // Don't save if only a revision if ( isset( $post->post_type ) && $post->post_type == 'revision' ) { return $post_id; } // Check permissions if ( !current_user_can( 'edit_post', $post->ID ) ) { return $post_id; } //echo "
";

    //print_r($_POST);



        $meta['wpt_banner_heading'] = ( isset( $_POST['wpt_banner_heading'] ) ? ( $_POST['wpt_banner_heading'] ) : '' );



        $meta['wpt_banner_btn_text'] = ( isset( $_POST['wpt_banner_btn_text'] ) ? ( $_POST['wpt_banner_btn_text'] ) : '' );



        $meta['wpt_banner_link'] = ( isset( $_POST['wpt_banner_link'] ) ? esc_url( $_POST['wpt_banner_link'] ) : '' );



        $meta['wpt_banner_heading2'] = ( isset( $_POST['wpt_banner_heading2'] ) ? ( $_POST['wpt_banner_heading2'] ) : '' );



        foreach ( $meta as $key => $value ) {

            update_post_meta( $post->ID, $key, $value );

        }

    }

    add_action( 'save_post', 'save_meta_boxes',  10, 2 );



    function testimonial_add_meta_boxes( $post ){

        add_meta_box( 'client_details', __( 'Client Details', 'authorpreneur' ), 'testimonial_build_meta_box', 'testimonial', 'normal', 'high' );

        add_meta_box( 'client_rating', __( 'Client Rating', 'authorpreneur' ), 'testimonial_build_meta_box_rating', 'testimonial', 'normal', 'high' );

    }

   //add_action( 'add_meta_boxes_testimonial', 'testimonial_add_meta_boxes' );



    function testimonial_build_meta_box() {

    global $post;



    wp_nonce_field( basename( __FILE__ ), 'client_fields' );

    $client_name   = get_post_meta( $post->ID, '_client_name', true );

    echo '';





    }



 function testimonial_build_meta_box_rating() {

    global $post;

    $client_rating = get_post_meta( $post->ID, '_client_rating', true );

    echo '';



    }





    function save_custom_meta_box($post_id, $post, $update)

{

    if (!isset($_POST["client_fields"]) || !wp_verify_nonce($_POST["client_fields"], basename(__FILE__)))

        return $post_id;



    if(!current_user_can("edit_post", $post_id))

        return $post_id;



    if(defined("DOING_AUTOSAVE") && DOING_AUTOSAVE)

        return $post_id;



    $slug = "testimonial";

    if($slug != $post->post_type)

        return $post_id;



    $client_rating = "";

    $client_name = "";





    if(isset($_POST["client_rating"]))

    {

        $client_rating = $_POST["client_rating"];

    }   

    update_post_meta($post_id, "_client_rating", $client_rating);



    if(isset($_POST["client_name"]))

    {

        $client_name = $_POST["client_name"];

    }   

    update_post_meta($post_id, "_client_name", $client_name);

}



add_action("save_post", "save_custom_meta_box", 10, 3);





function pagination($pages = '', $range = 4)

{

    $showitems = ($range * 2)+1;

 

    global $paged;

    if(empty($paged)) $paged = 1;

 

    if($pages == '')

    {

        global $wp_query;

        $pages = $wp_query->max_num_pages;

        if(!$pages)

        {

            $pages = 1;

        }

    }

 

    if(1 != $pages)

    {

        echo "
Page ".$paged." of ".$pages.""; if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "« First"; if($paged > 1 && $showitems < $pages) echo "‹ Previous"; for ($i=1; $i <= $pages; $i++) { if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems )) { echo ($paged == $i)? "".$i."":"".$i.""; } } if ($paged < $pages && $showitems < $pages) echo "Next ›"; if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) echo "Last »"; echo "
\n"; } }