Skip to content

Instantly share code, notes, and snippets.

@akyoscommunication
Last active June 15, 2021 09:34
Show Gist options
  • Save akyoscommunication/08df82cc32d66ace923718bfc4fafa7d to your computer and use it in GitHub Desktop.
Save akyoscommunication/08df82cc32d66ace923718bfc4fafa7d to your computer and use it in GitHub Desktop.
[Repeater in vc_map] Mettre un repeater dans l'admin d'un shortcode #wordpress # Shortcode
vc_map(
array(
'name' => __('Timeline', 'text-domain'),
'base' => 'akyos_timeline',
'description' => __('Une timeline', 'text-domain'),
'category' => __('Akyos Elements', 'text-domain'),
'params' => array(
array(
'type' => 'param_group',
'value' => '',
'param_name' => 'steps',
'params' => array(
array(
'type' => 'textfield',
'value' => '',
'heading' => 'Titre de l\'étape',
'param_name' => 'title',
),
array(
'type' => 'textfield',
'value' => '',
'heading' => 'Description',
'param_name' => 'desc',
)
),
)
)
)
);
}
public function akyos_timeline_html($atts, $content)
{
extract(shortcode_atts(array(
'steps' => ''
), $atts));
$html = '';
$steps = vc_param_group_parse_atts($steps);
$html .= '<div class="aky-timeline-container">';
foreach ($steps as $el) {
$html .= '<div class="aky-timeline-block">';
$html .= '<div class="aky-timeline-marker"></div>';
$html .= '<div class="aky-timeline-content">';
$html .= '<h3 class="aky-timeline-content__title">'.$el['title'].'</h3>';
$html .= '<p class="aky-timeline-content__text">'.$el['desc'].'</p>';
$html .= '</div>';
$html .= '</div>';
}
$html .= '</div>';
return $html;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment