Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function phalancs_group_meta_function($atts) {
- $atts = shortcode_atts([
- 'type' => 'ul', //ul, ol, div
- 'class' => 'group-meta', //ul, ol list
- 'icon' => 'external-link',
- 'meta_select' => '',
- 'fallback' => 'No elements selected.',
- 'post_id' => 0,
- ], $atts, 'phalancs_group_meta');
- if ($atts['meta_select'] != "") {
- $meta_select = get_post_meta( get_the_ID(), $atts['meta_select'], true );
- //print_r($meta_select);
- }
- if ( is_array($meta_select) ) {
- $html .= '<div class="vcex-module vcex-bullets custom-icon '.$atts['class'].'">';
- $html .= '<'.$atts['type'].'>';
- foreach ($meta_select as $key => $item) {
- if ($atts['type'] == 'ul' || $atts['type'] == 'ol') $html .= '<li>';
- $html .= $item;
- if ($atts['type'] == 'ul' || $atts['type'] == 'ol') $html .= '</li>';
- }
- $html .= '</'.$atts['type'].'>';
- $html .= '</div>';
- } else {
- $html = $atts['fallback'];
- }
- return $html;
- }
- add_shortcode('phalancs_group_meta', 'phalancs_group_meta_function');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement