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
/** | |
* @returns {wp.media.view.AttachmentCompat} Returns itself to allow chaining | |
*/ | |
render: function() { | |
var compat = this.model.get('compat'); | |
if ( ! compat || ! compat.item ) { | |
return; | |
} | |
this.$el.empty().append(this.$el); | |
this.views.detach(); |
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
jQuery(document).on('click', '.colorButton', function(event) { | |
var input = jQuery('input'); | |
input.css('background-color' , 'red'); | |
}); |
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
// Enqueue other custom javascript | |
function enqueue_custom_js(){ | |
//Adds your custom script | |
wp_enqueue_script('jquery'); | |
wp_register_script('jsbind', get_template_directory_uri() . '/js/javascriptbind.js' , array('jquery'), '1', true ); | |
wp_enqueue_script( 'jsbind'); | |
} | |
add_action('admin_enqueue_scripts','enqueue_custom_js'); |
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
/* | |
*In plugin file or functions.php add the following code to create new form fields in your media modal | |
*/ | |
function multiple_input_field( $form_fields, $post ) { | |
$foo = get_post_meta( $post->ID, 'foo', true ); | |
$form_fields['foo'] = array( | |
'label' => 'Is Foo', | |
'input' => 'html', | |
'html' => |
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
wp.media.view.AttachmentCompat.prototype.events['change {all selectors found in the if statement below}'] = 'save'; | |
if ( .name.length > 2 && '[]' == .name.substr( pair.name.length - 2 ) ) { | |
var pairName = .name.substr( 0, .name.length - 2 ); | |
if ( pairName in data ) { | |
data[ pairName ] += ',' + .value; | |
} else { | |
data[ pairName ] = .value; | |
} |
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
function getUsers(){ | |
header("Access-Control-Allow-Origin: *"); | |
$term = $_GET['search']; | |
// var_dump($_GET); | |
$args = array( | |
'search' => '*'.esc_attr( $term ).'*', | |
'fields' => array('first_name', 'last_name', 'ID', 'display_name'), | |
'meta_query' => array( | |
'relation' => 'OR', | |
array( |
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
final class myClass { | |
private static $instance; | |
public static function instance() { | |
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof myClass ) ) { | |
self::$instance = new myClass; | |
self::$instance->setup_constants(); | |
} |
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
array( | |
'label' => 'Location', | |
'desc' => '', | |
'id' => $prefix.'location', | |
'type' => 'loc_group', | |
'options' => array( | |
'location'=> array( | |
'options' => array( | |
'state' => array( |
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
.message[type=system] { color: #080; } | |
.message[type=error] { color: #f00; font-weight: bold; } | |
.message[type=reply] { color: #088; } | |
.message[type=error_reply] { color: #f00; } | |
.message[type=dcc_send_send] { color: #088; } | |
.message[type=dcc_send_receive] { color: #00c; } | |
.message[type=privmsg] {} | |
.message[type=notice] { color: #888; } | |
.message[type=action] { color: #080; } | |
.message[type=join] { color: #080; } |
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
// create your variable, add your "key" called event_event, and define what the value should be | |
//for front end | |
$edit_post = add_query_arg( 'edit_event', $user_post->ID, site_url('/edit-events/') ); | |
//for admin | |
$edit_post = add_query_arg( 'edit_event', $user_post->ID, admin_url('admin.php?page=example') ); | |
// then simply do this for your link | |
<a href="<?php echo $edit_post; ?>" title="edit event"><?php echo $user_post->post_title; ?></a> |