Support » Fixing WordPress » Customize Repeater

  • Saif

    (@saifullahsiddique)


    There are any option available in wordpress customizer where I can repeat some fields with a toggle panel?? For example, If I need to make a social media link repeater where users can control how many social media they use and how they need to show as well. How can I achieve this from my theme customizer???

    • This topic was modified 10 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Developing with WordPress topic
Viewing 4 replies - 1 through 4 (of 4 total)
  • Kaavya Iyer

    (@kaavyaiyer)

    Hi @saifullahsiddique

    Are you comfortable with code? If yes then you can try out – https://github.com/cristian-ungureanu/customizer-repeater

    Thread Starter Saif

    (@saifullahsiddique)

    Hello, @kaavyaiyer

    Yes, I’m comfortable with code. I’ve already checked the code of this guy. But, it’s only working fine with some inputs.

    I mean, when I took image field, it requires the icon field also and then icon and image choice field comes up. It’s not expecting. On other points, it’s not supported nested repeater also for all fields. Nested repeater supports only the social fields.

    It’s not like that what I actually looking for. If any other tools available instead of that, can you suggest me, please??

    FAISAL KHAN

    (@fkfaisalkhan007)

    I got it finally.
    problem is if you once set ‘customizer_repeater_icon_control’ => false it will display icon selector with three choices and if within these choices you select “icon” and accidently publish it.
    Then it will always send the selected ” icon ” to class.

    So solution is set ‘customizer_repeater_icon_control’ => true then select “image” in choice then publish it. now all set to default settings.
    You can hide now your icon control set ‘customizer_repeater_icon_control’ => true.

    And if you only enable ‘customizer_repeater_image_control’ => true now your image upload control will not hide.

    I think the developer did not make a condition check whether Icon control is enabled or disabled in render code. I will try to make one if I figure out where to place it.

    FAISAL KHAN

    (@fkfaisalkhan007)

    Just modify this in Class-customizer-repeater.php

    /**
    	 * Display image upload input.
    	 *
    	 * @param string $value Input value.
    	 * @param string $show Flag show/hide input if image is selected.
    	 */
    	private function image_control( $value = '', $show = '' ) {
    		?>
    		<div class="customizer-repeater-image-control" 
    		<?php
    		if ( 'customizer_repeater_icon_control' === true ) {
    			if ( $show === 'customizer_repeater_icon' || $show === 'customizer_repeater_none' ) {
    				echo 'style="display:none;"'; }
    		}
    		?>
    >
    			<span class="customize-control-title">
    				<?php esc_html_e( 'Image', 'avantex' ); ?>
    			</span>
    			<input type="text" class="widefat custom-media-url" value="<?php echo esc_attr( $value ); ?>">
    			<input type="button" class="button button-secondary customizer-repeater-custom-media-button" value="<?php esc_attr_e( 'Upload Image', 'avantex' ); ?>" />
    		</div>
    		<?php
    	}
Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.