This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_action( 'admin_head-post.php', 'admin_head_post_editing' ); | |
| add_action( 'admin_head-post-new.php', 'admin_head_post_new' ); | |
| add_action( 'admin_head-edit.php', 'admin_head_post_listing' ); | |
| function admin_head_post_editing() { | |
| echo ‘você está editando o post'; | |
| } | |
| function admin_head_post_new() { | |
| echo ‘você está criando um novo post'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function posts_for_current_author($query) { | |
| if (is_admin()) { | |
| $userLog = wp_get_current_user(); | |
| $userLogID = $userLog->ID; | |
| $query->set('author', $userLogID); | |
| return $query; | |
| # code... | |
| } | |
| } | |
| add_filter('pre_get_posts', 'posts_for_current_author'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function remove_wp_users_role() { | |
| /* remove tipos de usuários padrão do wordpress */ | |
| remove_role( 'subscriber' ); | |
| remove_role( 'contributor' ); | |
| remove_role( 'editor' ); | |
| remove_role( 'author' ); | |
| remove_role( '' ); | |
| } | |
| register_activation_hook( __FILE__, 'remove_wp_users_role' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function wp_restaure_roles_users(){ | |
| /* adiciona tipos de usuários padrão */ | |
| add_role( 'subscriber', 'Assinante', 'level_0' ); | |
| add_role( 'contributor', 'Contribuidor', 'level_1' ); | |
| add_role( 'editor', 'Editor', 'level_7' ); | |
| add_role( 'author', 'Autor', 'level_2' ); | |
| } | |
| register_activation_hook( __FILE__, 'wp_restaure_roles_users' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function active_plugins() { | |
| // código plugin | |
| } | |
| register_activation_hook( __FILE__, 'active_plugins' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function desactive_plugins() { | |
| // código plugin | |
| } | |
| register_activation_hook( __FILE__, 'desactive_plugins' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function list_users() { | |
| add_meta_box( 'list-users', 'usuários', 'users', 'imoveis'); | |
| } | |
| add_action( 'add_meta_boxes', 'list_users' ); | |
| function users() { | |
| $usuarios = get_users(); | |
| foreach ($usuarios as $usuario) { | |
| echo "<br>" . $usuario->user_nicename; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function cols_admin( $column ) { | |
| $column['foto'] = 'Foto'; | |
| return $column; | |
| } | |
| add_filter( 'manage_imoveis_posts_columns', 'cols_admin' ); | |
| function colsfield( $column_name, $post_id ) { | |
| $custom_fields = "foi"; | |
| if ($column_name == 'foto') { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Add two new role. | |
| // Full list of capabilities can be found at http://codex.wordpress.org/Roles_and_Capabilities#Capability_vs._Role_Table | |
| add_role('writer', 'Writer', array( | |
| 'delete_posts' => true, | |
| 'delete_published_posts' => true, | |
| 'edit_posts' => true, | |
| 'edit_published_posts' => true, | |
| 'publish_posts' => true, | |
| 'read' => true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function user_register() { | |
| echo " | |
| <form action='"; echo site_url('wp-login.php?action=register', 'login_post'); echo "' method='post'> | |
| <input type='text' name='user_login' value='Username' id='user_login' /> | |
| <input type='text' name='user_email' value='Mail' id='user_email' />"; | |
| do_action('register_form'); | |
| echo "<input type='submit' value='Register' id='register' />"; | |
| } | |
| add_shortcode( 'form_register', 'user_register' ); |
OlderNewer