Last active
November 18, 2016 16:06
-
-
Save whatsnewsisyphus/2cb0bedb69b4edbe32acd5648f66312a to your computer and use it in GitHub Desktop.
Adding a custom field
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
/** | |
* in elements_php in theme, under uncode_create_single_block | |
*/ | |
case 'relationship': | |
$relationship = get_field('test_relationship', $block_data['id']); | |
if($relationship) { | |
foreach( $relationship as $r ) { | |
$r_link = get_permalink( $r->ID ); | |
$r_title = get_the_title( $r->ID ); | |
$inner_entry .= '<a href="'.$r_link.'">'.$r_title.'</a>'.$separator; | |
if ($r !== end($relationship)){ | |
$inner_entry .= '<br /> '; | |
} | |
} | |
} | |
break; | |
/** | |
*in uncode_map.php in uncode_core plugin | |
*/ | |
array( | |
'relationship', | |
esc_html__('Relationship Links', 'uncode') , | |
) , |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment