'#f0f0f0', 'text_color' => '#262525', 'image_height' => 100, 'image_border_radius' => 0, 'navigation' => 'yes', 'indicators' => 'yes', 'transition_speed' => 500, 'auto_slide' => 'yes', 'interval' => 5000, 'pause_on_hover' => 'yes', ); public function __construct() { add_action( 'add_meta_boxes', array( $this, 'register_meta_boxes' ) ); add_action( 'save_post_bridgehub_slider', array( $this, 'save_slider_meta' ), 10, 2 ); } public function register_meta_boxes() { add_meta_box( 'bridgehub_testimonial_manager', __( 'Testimonials', 'aj-square-testimonial-slider' ), array( $this, 'render_testimonial_manager_metabox' ), 'bridgehub_slider', 'normal', 'high' ); add_meta_box( 'bridgehub_slider_settings', __( 'Slider Settings', 'aj-square-testimonial-slider' ), array( $this, 'render_slider_tabs_metabox' ), 'bridgehub_slider', 'normal', 'high' ); add_meta_box( 'bridgehub_developer', __( 'Developer', 'aj-square-testimonial-slider' ), array( $this, 'render_developer_metabox' ), 'bridgehub_slider', 'side', 'low' ); } private function get_value( $post_id, $key ) { $value = get_post_meta( $post_id, 'bridgehub_slider_' . $key, true ); if ( '' === $value || false === $value ) { return isset( $this->defaults[ $key ] ) ? $this->defaults[ $key ] : ''; } return $value; } private function get_testimonials_for_slider( $slider_id ) { $testimonial_ids = get_post_meta( $slider_id, 'bridgehub_testimonial_ids', true ); if ( is_array( $testimonial_ids ) && ! empty( $testimonial_ids ) ) { $testimonial_ids = array_map( 'absint', $testimonial_ids ); $query = new WP_Query( array( 'post_type' => 'bhub_testimonial', 'post__in' => $testimonial_ids, 'posts_per_page' => -1, 'post_status' => 'any', 'orderby' => 'post__in', ) ); $testimonials = $query->posts; wp_reset_postdata(); return $testimonials; } return array(); } public function render_testimonial_manager_metabox( $post ) { if ( 'auto-draft' === $post->post_status ) { ?>

get_testimonials_for_slider( $post->ID ); ?>

ID ); $thumb_url = $thumb_id ? wp_get_attachment_image_url( $thumb_id, 'thumbnail' ) : ''; $designation = get_post_meta( $testimonial->ID, 'bridgehub_testimonial_designation', true ); if ( '' === $designation ) { $designation = get_post_meta( $testimonial->ID, 'ajsqtesl_slider_subtitle', true ); } $company = get_post_meta( $testimonial->ID, 'bridgehub_testimonial_company', true ); $rating = absint( get_post_meta( $testimonial->ID, 'bridgehub_testimonial_rating', true ) ); $excerpt = wp_trim_words( $testimonial->post_content, 15 ); ?>
<?php echo esc_attr( $testimonial->post_title ); ?>
post_title ? $testimonial->post_title : __( '(Untitled)', 'aj-square-testimonial-slider' ) ); ?> , 0 ) : ?> ★' : '☆'; } ?>
__( 'General', 'aj-square-testimonial-slider' ), 'size' => __( 'Size', 'aj-square-testimonial-slider' ), 'controls' => __( 'Controls', 'aj-square-testimonial-slider' ), 'animations' => __( 'Animations', 'aj-square-testimonial-slider' ), 'autoplay' => __( 'Autoplay', 'aj-square-testimonial-slider' ), ); ?>
$tab_label ) : ?>
PX
%
MS
MS
post_status ) { ?>

ID ); $testimonials = $this->get_testimonials_for_slider( $post->ID ); $slide_count = count( $testimonials ); ?>

ID ); ?>

ID ) )->label ); ?>

'absint', 'bridgehub_slider_image_border_radius' => 'absint', 'bridgehub_slider_interval' => 'absint', 'bridgehub_slider_transition_speed' => 'absint', ); foreach ( $int_fields as $field => $sanitize_fn ) { if ( isset( $_POST[ $field ] ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Input is sanitized via the callback stored in $sanitize_fn. $value = call_user_func( $sanitize_fn, wp_unslash( $_POST[ $field ] ) ); update_post_meta( $post_id, $field, $value ); } } // Toggle fields. $toggle_fields = array( 'bridgehub_slider_auto_slide', 'bridgehub_slider_navigation', 'bridgehub_slider_indicators', 'bridgehub_slider_pause_on_hover', ); foreach ( $toggle_fields as $field ) { $value = isset( $_POST[ $field ] ) ? 'yes' : 'no'; update_post_meta( $post_id, $field, $value ); } } }