Tagged: repeater widgets
- This topic has 3 replies, 2 voices, and was last updated 2 years, 8 months ago by
Steve.
-
AuthorPosts
-
-
May 4, 2019 at 3:56 am #9377
osmansufyParticipantHi
I want to crate repeater field in widgets .Although create it but when save the widgets it save one field only and i can’t work with ‘forech’ loop .
my widget-form code is hare……<?php
piklist(‘field’, array(
‘type’ => ‘group’
, ‘field’ => ‘social_group’ // removing this parameter saves all fields as separate meta
, ‘label’ => __(‘Social item’, ‘VerumSocial’)
, ‘list’ => false
, ‘description’ => __(‘A grouped field with the field parameter set.’, ‘VerumSocial’)
, ‘add_more’ => true, ‘fields’ => array(
array(
‘type’ => ‘text’
, ‘field’ => ‘social_icon’
, ‘label’ => __(‘social_icon’, ‘VerumSocial’)
, ‘required’ => true
, ‘columns’ => 12
, ‘attributes’ => array(
‘placeholder’ => ‘social_icon’,
),)
, array(
‘type’ => ‘url’
, ‘field’ => ‘social_link’
, ‘label’ => __(‘Add social link’, ‘VerumSocial’)
, ‘columns’ => 12
, ‘attributes’ => array(
‘placeholder’ => ‘social link.’,
),
)
,
),
));and my widget code is hare
<?php
/*
Title: My Demo Widget
Description: A description of what my widget does
*/echo $before_widget;
$vsocial = $settings[‘social_group’];print_r($vsocial);
foreach ($vsocial as $vsocial) {
?>
“><i class=”fa fa-<?php echo $vsocial[0][‘social_icon’] ?>”></i>
<?phpecho $after_widget;
}
….output in front
Array ( [0] => Array ( [social_icon] => facebook [social_link] => https://www.facebook.com/ ) )
Attachments:
You must be logged in to view attached files. -
May 6, 2019 at 12:40 pm #9381
SteveKeymasterDoes the Piklist Demos repeater work as expected?
-
May 16, 2019 at 6:14 pm #9387
osmansufyParticipantSorry for late sir . After a lots of time it’s works but when i change the field name(demo field) it dosn’t work . why sir? how to fix these bug ?
-
May 24, 2019 at 10:06 am #9392
SteveKeymasterso,
$vsocial = $settings[‘social_group’];is not returning any data?
-
-
AuthorPosts
- You must be logged in to reply to this topic.