01/28/2019 at 12:29 pm
#482853
Keymaster
@ Joshua
RE: provide an example of adding a website link programmatically?
It is much like adding an address. Here’s and expended example from my original reply.
$entry = new cnEntry();
$entry->setStatus( 'approved' );
$entry->setEntryType( 'organization' );
$entry->setOrganization( '~Test' );
$entry->addresses->add(
new cnAddress(
array(
'line_1' => '1600 Pennsylvania Ave NW',
'city' => 'Washington',
'state' => 'DC',
'zipcode' => '20500',
)
)
);
$entry->links->add(
new cnLink(
array(
'title' => 'Connections Business Directory Plugin for WordPress',
'url' => 'https://connections-pro.com',
)
)
);
$result = $entry->save();
if ( FALSE !== $result ) {
$default = get_option( 'cn_default_category' );
Connections_Directory()->term->setTermRelationships( $entry->getId(), $default, 'category' );
}
Hope this helps!