Home » Archive

Articles in the Code Snippets Category

Code Snippets, Wordpress »

[6 Mar 2011 | One Comment | ]

I just finished writing a post that will give you simple instructions for your WordPress blog on how to hide the media tab from the uploads dialog box on the post page for contributors – good – but we still want our WordPress contributors to be able to upload media such as images correct? Correct! There’s nothing like a nice article with a nice image and who wants to read simple plain text all the time? I don’t.
So if you allow people to join your WordPress blog website and contribute …

Code Snippets, Wordpress »

[6 Mar 2011 | One Comment | ]

Sometime we don’t want to give our WordPress blog contributors access to the media tab because that gives them the ability to manipuate other user’s images and so forth. Well here’s a little fix that helps you block contributors from using the media tab without having to install extra WordPress plugins. Copy the code below into your functions.php file in your theme directory:
function remove_medialibrary_tab($tabs) {
unset($tabs['library']);
return $tabs;
}
if(!current_user_can(‘edit_others_posts’)) add_filter(‘media_upload_tabs’,'remove_medialibrary_tab’);
That should work. Enjoy!

Code Snippets, Featured »

[19 Feb 2011 | No Comment | ]
Dynamic Year Copyright Date For PHP

This post is mainly for me. I don’t memorize much PHP code so from time to time I have to search the net. In this case I’m going to post the code needed for a dymanic year – meaning the year changes automatically as each year passes – this is mainly, in my case for use in the copyright notice as it is displayed in the footer of this page.
Here is the code to generate the year in PHP:
date(“Y”)
That’s not too heavy is it? Enjoy!