// insert the post and set the category
$post_id = wp_insert_post(array (
'post_type' => 'your_post_type',
'post_title' => $your_title,
'post_content' => $your_content,
'post_status' => 'publish',
'comment_status' => 'closed', // if you prefer
'ping_status' => 'closed', // if you prefer
));if ($post_id) {
// insert post meta
add_post_meta($post_id, '_your_custom_1', $custom1);
add_post_meta($post_id, '_your_custom_2', $custom2);
add_post_meta($post_id, '_your_custom_3', $custom3);
}
Continuous integration
This continuous application of quality control aims to improve the quality of software, and to reduce the time taken to deliver it, by replacing the traditional practice of applying quality control aftercompleting all development. This is very similar to the original idea of integrating more frequently to make integration easier, only applied to QA processes.
Git: Feature Branch Workflow
Once Bill is ready to accept the pull request, someone needs to merge the feature into the stable project (this can be done by either Bill or Mary):
git checkout master git pull git pull origin marys-feature git push
First, whoever’s performing the merge needs to check out their
master
branch and make sure it’s up to date. Then,git pull origin marys-feature
merges the central repository’s copy ofmarys-feature
. You could also use a simplegit merge marys-feature
, but the command shown above makes sure you’re always pulling the most up-to-date version of the feature branch. Finally, the updatedmaster
needs to get pushed back toorigin
.
The power of MySQL’s GROUP_CONCAT
In the very early days of Percona Vadim wrote very nice post about GROUP_CONCAT.
mysql> SELECT DISTINCT-> parent_id, child_id-> FROM group_c-> ORDER BY parent_id;+—————–+—————+| parent_id | child_id |+—————–+—————+| 1 | 1 || 1 | 2 || 1 | 3 || 1 | 4 || 2 | 1 || 2 | 3 || 2 | 4 || 2 | 6 || 3 | 1 || 3 | 2 || 4 | 1 || 5 | 0 |+—————–+—————+12 rows in set (0.00 sec)
mysql> SELECT DISTINCT-> parent_id, GROUP_CONCAT(DISTINCT child_id ORDER BY child_id) AS child_id_list-> FROM group_c-> group by parent_id-> ORDER BY parent_id;+—————–+———————–+| parent_id | child_id_list |+—————–+———————–+| 1 | 1,2,3,4 || 2 | 1,3,4,6 || 3 | 1,2 || 4 | 1 || 5 | 0 |+—————–+———————–+5 rows in set (0.00 sec)