1

Is there a way to change text in Add Item button for repeater?

"Add Item" button text, Its a single button that adds new repeater item.

I have muliple repeaters and I want each to have different text. enter image description here

Here for example one repeater where I'd like to have "Add Breakpoint" instead of "Add Item" for the button at the end of the listing.

This is what I've tried so far:

$repeater = new \Elementor\Repeater();

$repeater->add_control(
    'caption_bp_width', [
        'label' => esc_html__( 'Player max width [px]', E_VPL_TEXTDOMAIN ),
        'type' => \Elementor\Controls_Manager::NUMBER,
        'label_block' => false,
    ]
);

$repeater->add_control(
    'caption_bp_font_size', [
        'label' => esc_html__( 'Font size [px]', E_VPL_TEXTDOMAIN ),
        'type' => \Elementor\Controls_Manager::NUMBER,
        'label_block' => false,
    ]
);

$this->add_control(
    'caption_data_a',
    [
        'label' => esc_html__( 'Subtitle font size breakpoints', E_VPL_TEXTDOMAIN ),
        'type' => \Elementor\Controls_Manager::REPEATER,
        'fields' => $repeater->get_controls(),
        'default' => $sub_arr,
        'prevent_empty' => false, 
        'title_field' => '{{{ caption_bp_width }}}',
    ]
);
5
  • Your question is a bit unclear: All options already have different text in your screenshot. It could help to clarify what kind of different text you want (additionally?)? Perhaps also by telling what you've tried so far and how it didn't work in your favour. Commented Nov 20 at 11:40
  • "Add Item" button text? Its a single button that adds new repeater item. Commented Nov 20 at 14:36
  • Ah, that one, thanks for clarifying (but you should not clarify that in a comment, but within your question). Also please clarify for how many languages you need to change the button text and provide the text(s) you want to replace it with. Commented Nov 20 at 15:15
  • I would just change it in php where I initiate the repeaters to one language. Commented Nov 20 at 17:30
  • And there you found it it seems. You should add at least a description next to the code fence in your answer, as code only answers are not really telling the story behind. Just FYI. Commented Nov 20 at 18:10

1 Answer 1

0
Kirki::add_field( 'theme_config_id', [
    'type'        => 'repeater',
    'settings'    => 'subtitle_breakpoints',
    'label'       => esc_html__( 'Subtitles', 'textdomain' ),
    'button_label'=> esc_html__( 'Add Breakpoint', 'textdomain' ), 
    'fields'      => [
        'value' => [
            'type'  => 'text',
            'label' => esc_html__( 'Breakpoint Value', 'textdomain' ),
        ],
    ],
] );
Sign up to request clarification or add additional context in comments.

1 Comment

Can you clarify more, where do I use this? Whatis Kirki? I use Elementor.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.