start_controls_section( 'section_content', [ 'label' => __( 'Author Box', 'admore-widgets-suite' ), ] ); $this->add_control( 'author_source', [ 'label' => __( 'Author Source', 'admore-widgets-suite' ), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => 'current', 'options' => [ 'current' => __( 'Current Post Author', 'admore-widgets-suite' ), 'custom' => __( 'Custom', 'admore-widgets-suite' ), ], ] ); $this->add_control( 'custom_name', [ 'label' => __( 'Name', 'admore-widgets-suite' ), 'type' => \Elementor\Controls_Manager::TEXT, 'default' => __( 'John Doe', 'admore-widgets-suite' ), 'condition' => [ 'author_source' => 'custom' ], 'dynamic' => [ 'active' => true ], ] ); $this->add_control( 'custom_role', [ 'label' => __( 'Role / Title', 'admore-widgets-suite' ), 'type' => \Elementor\Controls_Manager::TEXT, 'default' => __( 'Content Writer', 'admore-widgets-suite' ), 'condition' => [ 'author_source' => 'custom' ], 'dynamic' => [ 'active' => true ], ] ); $this->add_control( 'custom_bio', [ 'label' => __( 'Bio', 'admore-widgets-suite' ), 'type' => \Elementor\Controls_Manager::TEXTAREA, 'rows' => 4, 'default' => __( 'A passionate writer sharing knowledge and expertise on a wide range of topics.', 'admore-widgets-suite' ), 'condition' => [ 'author_source' => 'custom' ], 'dynamic' => [ 'active' => true ], ] ); $this->add_control( 'custom_avatar', [ 'label' => __( 'Avatar', 'admore-widgets-suite' ), 'type' => \Elementor\Controls_Manager::MEDIA, 'condition' => [ 'author_source' => 'custom' ], 'dynamic' => [ 'active' => true ], ] ); $this->add_control( 'show_posts_link', [ 'label' => __( 'Show "View All Posts" Link', 'admore-widgets-suite' ), 'type' => \Elementor\Controls_Manager::SWITCHER, 'default' => 'yes', 'return_value' => 'yes', ] ); $this->add_control( 'show_social', [ 'label' => __( 'Show Social Links', 'admore-widgets-suite' ), 'type' => \Elementor\Controls_Manager::SWITCHER, 'return_value' => 'yes', ] ); $this->add_control( 'layout', [ 'label' => __( 'Layout', 'admore-widgets-suite' ), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => 'horizontal', 'options' => [ 'horizontal' => __( 'Horizontal', 'admore-widgets-suite' ), 'vertical' => __( 'Vertical (Card)', 'admore-widgets-suite' ), ], 'prefix_class' => 'eppro-ab--layout-', ] ); $this->end_controls_section(); /* ── Social Links ── */ $this->start_controls_section( 'section_social', [ 'label' => __( 'Social Links', 'admore-widgets-suite' ), 'condition' => [ 'show_social' => 'yes' ], ] ); foreach ( [ 'twitter' => 'Twitter / X', 'facebook' => 'Facebook', 'instagram' => 'Instagram', 'linkedin' => 'LinkedIn', 'youtube' => 'YouTube', 'github' => 'GitHub', 'website' => 'Website' ] as $key => $label ) { $this->add_control( 'social_' . $key, [ 'label' => $label, 'type' => \Elementor\Controls_Manager::URL, 'placeholder' => 'https://' . $key . '.com', 'dynamic' => [ 'active' => true ], ] ); } $this->end_controls_section(); /* ── Style ── */ $this->start_controls_section( 'section_style', [ 'label' => __( 'Style', 'admore-widgets-suite' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'bg_color', [ 'label' => __( 'Background', 'admore-widgets-suite' ), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#f8fafc', 'selectors' => [ '{{WRAPPER}} .eppro-ab-wrap' => 'background-color: {{VALUE}};' ], ] ); $this->add_control( 'border_radius', [ 'label' => __( 'Border Radius', 'admore-widgets-suite' ), 'type' => \Elementor\Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 30 ] ], 'default' => [ 'size' => 12 ], 'selectors' => [ '{{WRAPPER}} .eppro-ab-wrap' => 'border-radius: {{SIZE}}px;' ], ] ); $this->add_control( 'avatar_size', [ 'label' => __( 'Avatar Size', 'admore-widgets-suite' ), 'type' => \Elementor\Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 40, 'max' => 200 ] ], 'default' => [ 'size' => 80 ], 'selectors' => [ '{{WRAPPER}} .eppro-ab-avatar' => 'width: {{SIZE}}px; height: {{SIZE}}px;' ], ] ); $this->add_control( 'avatar_shape', [ 'label' => __( 'Avatar Shape', 'admore-widgets-suite' ), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => 'circle', 'options' => [ 'circle' => __( 'Circle', 'admore-widgets-suite' ), 'square' => __( 'Square', 'admore-widgets-suite' ), 'rounded' => __( 'Rounded', 'admore-widgets-suite' ), ], 'selectors' => [ '{{WRAPPER}} .eppro-ab-avatar' => 'border-radius: {{VALUE}};', ], 'selectors_dictionary' => [ 'circle' => '50%', 'square' => '0', 'rounded' => '12px', ], ] ); $this->add_control( 'name_color', [ 'label' => __( 'Name Color', 'admore-widgets-suite' ), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#1e293b', 'selectors' => [ '{{WRAPPER}} .eppro-ab-name' => 'color: {{VALUE}};' ], ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'name_typography', 'selector' => '{{WRAPPER}} .eppro-ab-name', ] ); $this->add_control( 'bio_color', [ 'label' => __( 'Bio Color', 'admore-widgets-suite' ), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#64748b', 'selectors' => [ '{{WRAPPER}} .eppro-ab-bio' => 'color: {{VALUE}};' ], ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'bio_typography', 'selector' => '{{WRAPPER}} .eppro-ab-bio', ] ); $this->add_control( 'role_color', [ 'label' => __( 'Role / Position Color', 'admore-widgets-suite' ), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#7c3aed', 'selectors' => [ '{{WRAPPER}} .eppro-ab-role' => 'color: {{VALUE}};' ], 'separator' => 'before', ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'role_typography', 'selector' => '{{WRAPPER}} .eppro-ab-role', ] ); $this->add_control( 'posts_link_color', [ 'label' => __( 'Posts Link Color', 'admore-widgets-suite' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .eppro-ab-posts-link' => 'color: {{VALUE}};' ], ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'posts_link_typography', 'selector' => '{{WRAPPER}} .eppro-ab-posts-link', ] ); $this->add_control( 'social_icon_color', [ 'label' => __( 'Social Icon Color', 'admore-widgets-suite' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .eppro-ab-social a' => 'color: {{VALUE}};' ], 'separator' => 'before', ] ); $this->add_control( 'social_icon_color_hover', [ 'label' => __( 'Social Icon Hover Color', 'admore-widgets-suite' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .eppro-ab-social a:hover' => 'color: {{VALUE}};' ], ] ); $this->add_responsive_control( 'social_icon_size', [ 'label' => __( 'Social Icon Size', 'admore-widgets-suite' ), 'type' => \Elementor\Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 12, 'max' => 40 ] ], 'default' => [ 'size' => 18 ], 'selectors' => [ '{{WRAPPER}} .eppro-ab-social a' => 'font-size: {{SIZE}}px;', '{{WRAPPER}} .eppro-ab-social a svg' => 'width: {{SIZE}}px; height: {{SIZE}}px;' ], ] ); $this->add_group_control( \Elementor\Group_Control_Border::get_type(), [ 'name' => 'wrap_border', 'selector' => '{{WRAPPER}} .eppro-ab-wrap', 'separator' => 'before', ] ); $this->add_responsive_control( 'wrap_padding', [ 'label' => __( 'Padding', 'admore-widgets-suite' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em' ], 'default' => [ 'top'=>'24','right'=>'24','bottom'=>'24','left'=>'24','unit'=>'px' ], 'selectors' => [ '{{WRAPPER}} .eppro-ab-wrap' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], 'separator' => 'before', ] ); $this->add_group_control( \Elementor\Group_Control_Box_Shadow::get_type(), [ 'name' => 'wrap_shadow', 'selector' => '{{WRAPPER}} .eppro-ab-wrap', ] ); $this->end_controls_section(); } protected function render(): void { $s = $this->get_settings_for_display(); $source = $s['author_source'] ?? 'current'; if ( 'current' === $source && in_the_loop() ) { $author_id = get_the_author_meta('ID'); $name = get_the_author_meta('display_name'); $bio = get_the_author_meta('description'); $role = ''; $avatar_url = get_avatar_url( $author_id, [ 'size' => 160 ] ); $posts_url = get_author_posts_url( $author_id ); } else { $name = $s['custom_name'] ?? 'Author Name'; $bio = $s['custom_bio'] ?? ''; $role = $s['custom_role'] ?? ''; $avatar_url = $s['custom_avatar']['url'] ?? ''; $posts_url = '#'; } ?>