Skip to content

Instantly share code, notes, and snippets.

Mohammad Jangda mjangda

Block or report user

Report or block mjangda

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View wp-android-checkstyle.diff
diff --git a/tools/ b/tools/
index 8f536e2..e206727 100755
--- a/tools/
+++ b/tools/
@@ -1,7 +1,7 @@
-if [ x"$1" == x ]; then
+if [ -z "$1" ]; then
checkstyle -c cq-configs/checkstyle/checkstyle.xml -r src/
View usage.php
vip_register_async_script( 'twitter', '' );
mjangda / wp-media_author.php
Created Feb 22, 2010
Adding an "author" dropdown to the Media Uploader
View wp-media_author.php
// Just an example. Probably doesn't work.
add_filter('attachment_fields_to_edit', 'add_media_author_field', 10, 2);
add_filter('attachment_fields_to_save', 'save_media_author'), 10, 2);
function add_media_author_field($fields, $post) {
// add the dropdown to $fields
$fields['media-author'] = array(
'label' => __('Credit:'),
mjangda / jqtouch.html
Created Feb 23, 2010
How to load jQTouch to a different div than the main one
View jqtouch.html
<script type="text/javascript">
// Save the hash the user loaded the page with
var page = (location.hash) ? location.hash : '';
// When you instantiate the jQTouch object, it will revert the hash to the top div on the page or the div with class="current"
$jQT = new $.jQTouch({
icon: 'jqtouch.png',
statusBar: 'black-translucent',
preloadImages: [
mjangda / coauthors-plus_hybrid.php
Created Feb 24, 2010
How to show co-authors when using the Hybrid theme
View coauthors-plus_hybrid.php
add_filter( 'hybrid_byline', 'my_byline' );
function my_byline( $byline ) {
global $post;
if ( 'post' == $post->post_type ) {
$authors_list = '';
if(function_exists('get_coauthors')) {
$coauthors = get_coauthors();
mjangda / editflow-filter_recipients.php
Created Mar 3, 2010
Quick an easy way to remove author and current user from the notification recipients. Works in Edit Flow 0.4+
View editflow-filter_recipients.php
function filter_recipients($recipients, $post) {
// grab the users we want to filter
$author = get_userdata($post->post_author);
$current_user = wp_get_current_user();
// Remove author and user who made the change from notification
$recipients = array_values( array_diff( $recipients,array($author->user_email, $current_user->user_email) ) ); // sorta hacky way to remove the element, found here:
mjangda / author-edit_others_posts.php
Created Mar 31, 2010
Allow WordPress authors to edit all posts (not just their own)
View author-edit_others_posts.php
global $wp_roles;
if ( ! isset( $wp_roles ) )
$wp_roles = new WP_Roles();
if( $wp_roles->is_role('author') ) {
$author_role =& get_role('author');
mjangda / wp_mail_custom_names.php
Created May 12, 2010
How to change the "From" name and email address for outgoing WordPress emails
View wp_mail_custom_names.php
add_filter( 'wp_mail_from', 'mycustom_wp_mail_from' );
function mycustom_wp_mail_from( $from_email ) {
return '';
add_filter( 'wp_mail_from_name', 'mycustom_wp_mail_from_name' );
function mycustom_wp_mail_from_name( $from_name ) {
return 'John Doe';
mjangda / wp-events-widgets.php
Created Jun 4, 2010
Utility functions and a sample widget to display the next event
View wp-events-widgets.php
function events_get_next_event() {
global $wpdb;
$events_table = $wpdb->prefix . 'events';
$date_now = current_time('timestamp');
$query = $wpdb->prepare("SELECT * FROM $events_table WHERE thetime > %s ORDER BY thetime ASC LIMIT 1", $date_now);
$event = $wpdb->get_row($query);
mjangda / gleesays.html
Created Jun 7, 2010
An easy way to add some sweet lookin' Glee quotes to your blog
View gleesays.html
<div style="text-align: center; font-size: 10px">
<img src="" alt="Glee Quote!" />
<br />
<a href="">Powered by Gleeks United</a>
You can’t perform that action at this time.