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)
Showing posts with label wordpress. Show all posts
Showing posts with label wordpress. Show all posts
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>';
}
}
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');
Wednesday, November 12, 2014
Auto generate youtube thumbnail on wordpress article when sharing on facebook
This tutorial will show you how to make your wordpress article looks like the image that is shown when shared on facebook without doing any screen capture.
On wordpress 4.0, Youtube embedding has been made easy. You can simply paste the link of a youtube video and it will show immediately, however the wordpress social sharing preview on facebook is not yet optimize.
Facebook uses og meta tags to display the title, image and description on its timeline. In order for our wordpress article to show the correct info on facebook timeline we need to generate og meta tags on our article.
Install Wordpress Plugin
In this tutrorial We will use Wordpress Social Graph Plugin to generate our og meta tags.
after installation and activation of the plugin, we can now see the new meta box in our post create.
Insert Thumbnail from youtube
http://img.youtube.com/vi/[youtube id]/0.jpg http://img.youtube.com/vi/[youtube id]/1.jpg http://img.youtube.com/vi/[youtube id]/2.jpg http://img.youtube.com/vi/[youtube id]/3.jpg
we will use thelargest image of the 4 http://img.youtube.com/vi/[youtube id]/0.jpg
To verify if our meta image works. visit the article and view its page source.
We can still add several meta tags but for now i will only show the meta image to cut it short.
Use facebook lint to check the output
Facebook Lint is a tool to help us test our content sharing output. It also gives us recommendation on fixing and improving our content.
And The Result :
Sunday, October 5, 2014
login form header wordpress plugin
this is a very light weight plugin that will show login input upon activation. modifying it is also easy. individual css and html file is included.
Download
jquery codes anywhere in html or php file in wordpress
If your having trouble on running jquery codes that is hardcoded in your .php or .html file try using these codes
jQuery(document).ready(function() {
alert('this is alert!');
})
Subscribe to:
Posts (Atom)
