if ( !is_super_admin() ) {
add_action('admin_head', 'hideElement');
function hideElement() {
echo '<style>
#menu-media{
display:none !important;
}
</style>';
}
}
note that this method is not the best way to hide the tabs in our wordpress backend. It is not bulletproof and secure.
Labels
- bootstrap (1)
- css (4)
- jquery (16)
- Live Demo (14)
- Others (2)
- PHP (4)
- prestashop 1.6 (7)
- Topic - Advance (7)
- Topic - basic (27)
- Topic - Semi Advance (16)
- wordpress (6)
- wordpress plugins (1)
- YII (14)
Tuesday, December 16, 2014
Hide tabs in wordpress backend if user is not admin
This simple and easy script will hide the media tab in the backend of wordpress if the current user that is logged-in is not admin.
we use css to hide the tabs.
Run a css depending on the current logged in username
This script will add custom css on our wordpress backend if the current logged in user name is "guest".
$current_user = wp_get_current_user();
if ( $current_user->user_login == "guest" ) {
add_action('admin_head', 'hideMenus');
function hideMenus() {
echo '<style>
#menu-media,#menu-comments,#menu-users,#menu-posts{
display:none !important;
}
</style>';
}
}
Friday, December 12, 2014
Get the width and height of a div using jquery
This code shows how to get the width and height of a container, We must know the css selector of the div in order to do this.
//get the class or id of the container
$('.container').width();
$('.container').height();
Thursday, December 4, 2014
Add button next to add media in create post wordpress
PREVIEW:
// add button next to add media button
function add_my_media_button() {
echo 'Custom button next to Add media';
}
add_action('media_buttons', 'add_my_media_button');
Tuesday, December 2, 2014
Social media sliding menu on hover using css only
This social media menu is purely css3.
Preview:
We used css3 for the transition and font awesome for the icons.
note: You can copy the css codes on the css tab of the live demo(js fiddle).
Subscribe to:
Comments (Atom)