Ioannis Karavas
Software Engineer
Music Industry
E-commerce
Organizations
Who uses WordPress?
<?php add_filter( 'body_class', 'gimme_browser' ) ?>function gimme_browser($classes) {
global $is_IE, $is_opera, $is_chrome, $is_iphone;
if ($is_chrome) $classes[] = 'chrome';
elseif ($is_opera) $classes[] = 'opera';
...
return $classes;
}add_action( 'user_register', 'handle_new_user' );function handle_new_user($user_id) {
$user_info = ...
$new_post = array(
'post_name' => $user_name,
...
'post_excerpt' => '...',
'post_content' => 'Prompt user...'
);
wp_insert_post( $new_post, $wp_error );
}function child_styles() {
wp_enqueue_style(
'parent-style',
get_template_directory_uri().'/style.css');
}add_action( 'wp_enqueue_scripts', 'child_styles' );functions.php is not overwritten!
function restrict_editor() {
$editorRole = get_role( 'editor' );
$capabilities = array(
'edit_others_posts',
...
);
foreach ( $capabilities as $capability ) {
$editorRole->remove_cap( $capability );
}
}add_action( 'init', 'restrict_editor' );add_action( 'init', 'add_new_role' );function add_new_role() {
add_role(
'junior',
__('Junior'),
array(
'read' => true,
'edit_posts' => true,
'delete_posts' => false,
)
);
}add_action( 'init', 'create_custom_post_type' );function create_custom_post_type() {
register_post_type('projects',
array(
'labels' => array(
'name' => __('Projects'),
'singular_name' => __('Projects'),
)
...
)
);
}Ioannis Karavas
Software Engineer