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 default class for img-responsive | |
function add_image_responsive_class($content) { | |
global $post; | |
$pattern ="/<img(.*?)class=\"(.*?)\"(.*?)>/i"; | |
$replacement = '<img$1class="$2 img-responsive"$3>'; | |
$content = preg_replace($pattern, $replacement, $content); | |
return $content; | |
} | |
add_filter('the_content', 'add_image_responsive_class'); |
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
/* make post-thumbnails responsive by default */ | |
add_filter('post_thumbnail_html','tm_add_class_to_thumbnail'); | |
function tm_add_class_to_thumbnail($thumb) { | |
$thumb = str_replace('attachment-', 'img-responsive attachment-', $thumb); | |
return $thumb; | |
} |
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
/** | |
* Responsive WordPress Core Theme Styles | |
* http://jeffsebring.com/responsive-wordpress-images/ | |
--------------------------------------------------- */ | |
.sticky, | |
.bypostauthor, | |
.gallery-caption { | |
display: normal; | |
} |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
// API Request | |
$url = 'http://localhost/um-api/get.user/?id=1'; | |
// Include your public key and token to the URL | |
$url = add_query_arg('key', '75d9a913782eee3d990e4464ce26213e', $url ); | |
$url = add_query_arg('token', 'bae6ee38cf02a50a0ac8259eed34ceb9', $url ); | |
// Process your request | |
$request = wp_remote_get( $url ); | |
$response = json_decode( wp_remote_retrieve_body( $request ) , 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
<?php echo do_shortcode('[ultimatemember_message_button user_id='.$user_id.']'); ?> |
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
/* | |
This code sample shows you how to use the API to create | |
and add custom notifications (for real-time notifications) | |
plugin. | |
STEP 1: You need to extend the filter: um_notifications_core_log_types with your | |
new notification type as follows for example | |
*/ |
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
/* This example syncs both UM / WP role during user approval */ | |
add_action('um_after_user_is_approved', 'sync_um_and_wp_role', 99 ); | |
function sync_um_and_wp_role( $user_id ) { | |
// Get UM role | |
$role = get_user_meta( $user_id, 'role', true ); | |
// Set WordPress role for same user | |
$wp_user_object = new WP_User( $user_id ); |
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('um_submit_form_errors_hook', 'check_customer_code', 100 ); | |
function check_customer_code( $args ){ | |
if ( isset( $args['customer_code'] ) && $args['customer_code'] != 'ABCDE' ) | |
exit( wp_redirect( add_query_arg('err', 'invalid_customer_code') ) ); | |
} |
OlderNewer