Skip to content

Instantly share code, notes, and snippets.

@whatsnewsisyphus
Last active November 18, 2016 16:06
Show Gist options
  • Save whatsnewsisyphus/2cb0bedb69b4edbe32acd5648f66312a to your computer and use it in GitHub Desktop.
Save whatsnewsisyphus/2cb0bedb69b4edbe32acd5648f66312a to your computer and use it in GitHub Desktop.
Adding a custom field
/**
* 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