Created
March 1, 2018 23:26
-
-
Save ulaulaman/01f3804fce7803c2183c50f9ebc8aa2d to your computer and use it in GitHub Desktop.
Shortcode to show group field
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_shortcode('eduinaf-loop', 'eduinaf_loop'); | |
function eduinaf_loop( $attr = array() ) { | |
$post = get_post(); | |
$curriculum = get_post_meta( $post->ID, '_eduinaf_curriculum_scolastico', true ); | |
$output = ''; | |
if ( empty( $curriculum ) ) { | |
return $output; | |
} | |
$output .= '<ul>'; | |
foreach ( $curriculum as $entry ) { | |
$output .= '<li>'; | |
$output .= 'Livello scolastico: ' . esc_attr( $entry['_livello_scolastico'] ) . '</br>'; | |
$output .= 'Materia: ' . esc_attr( $entry['_materia'] ) . '<br/>'; | |
$output .= 'Argomento: ' . esc_attr( $entry['_argomento'] ); | |
$output .= '</li>'; | |
} | |
$output .= '</ul>'; | |
return $output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment