Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Parse data stored as term description
- *
- * @param string $meta Term description formatted with new line for earch 'field'
- * @param string $field Field to return
- *
- * @return string $output String to use in templates
- */
- function custom_term_meta( $meta, $field = 'meta' ) {
- // explode array on new line
- $meta = explode("\n", $meta);
- // decide what to output
- switch ($field) {
- case 'description':
- $output = $meta[0];
- break;
- case 'thumb':
- $output = $meta[1];
- break;
- case 'link':
- $output = $meta[2];
- break;
- case 'meta':
- $output = $meta[0];
- $output .= $meta[2];
- break;
- }
- // formatting for archive views
- if( is_category() || is_tag() || is_tax() ) {
- $output = make_clickable( $output );
- }
- return $output;
- }
Advertisement
Add Comment
Please, Sign In to add comment