Please note that in the above example, we have to wrap the new boxes with the jQuery object. This is because the .masonry() call expects an jQuery object in the 2nd parameter.
If you want to update the node programmatically, the following example update the node title and the value of the custom field called field_example.
// Load the node with nid = 1
$nid = 1;
$a_node = node_load($nid);
$a_node->title = 'new title';
$a_node->field_example['und'][0]['value'] = 'new value';
// Save the node
node_save($a_node);
// If you want to populate the node author and creation date, call node_submit() before saving
/*
if($a_node = node_submit($a_node)) {
// Save the node
node_save($a_node);
}
*/
We can get the number of returned rows in db_select() by ->rowCount().
// Get the number of nodes created by administrator
$query = db_select('node', 'n');
$result = $query->fields('n', array('nid'))->condition('uid', 1, '=')->execute();
return $result->rowCount();
After I have installed the Date module, I could create a content type with a date field called field_expiry_date. When i setup this field, there are 3 date options in the field type.