Last active
June 29, 2018 05:11
-
-
Save rafaehlers/4052dd930d2a797ef059e31344a58b14 to your computer and use it in GitHub Desktop.
Shortcode that accepts a category field which is usually displayed as bullet points and turns into a comma separated values string
This file contains hidden or 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 | |
//usage [gv_listify field="{Field Merge Tag}"] | |
add_shortcode( 'gv_listify', 'gv_listify_shortcode' ); | |
function gv_listify_shortcode( $atts ) { | |
extract( shortcode_atts( | |
array( | |
'field' => '', | |
), $atts ) | |
); | |
$content = str_replace(',','</li><li>',$field); | |
$content = '<ul><li>'.$content.'</li></ul>'; | |
return $content; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment