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 | |
/* Add WP Media Uploader in Plugin */ | |
add_action('admin_enqueue_scripts', 'custom_admin_media_scripts'); | |
function custom_admin_media_scripts() { | |
if (isset($_GET['page']) && $_GET['page'] == 'custom-icons-settings-page') { | |
wp_enqueue_media(); | |
wp_register_script('custom-media-uploader-js', WP_PLUGIN_URL.'/custom-theme-settings-plugin/js/media.js', array('jquery')); | |
wp_enqueue_script('custom-media-uploader-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
<?php | |
/* Add extra fields in media attachment */ | |
/** | |
* Add Photographer Name and URL fields to media uploader | |
* | |
* @param $form_fields array, fields to include in attachment form | |
* @param $post object, attachment record in database | |
* @return $form_fields, modified form fields | |
*/ | |
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 ($) { | |
$(document).ready(function () { | |
$("#calendar").datepicker({ | |
dateFormat: 'yyyy-mm-dd', | |
beforeShowDay: function (date) { | |
return [true, 'reserved', 'this date reserved']; | |
}, | |
onSelect: function (date, el) { | |
var day = el.selectedDay, | |
mon = el.selectedMonth, |
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
/* Pseudo code with Javascript snippets: */ | |
// Immediately create a blank popup on user action | |
var importantStuff = window.open('', '_blank'); | |
// Optional: add some "waiting" info message. Examples: | |
// a) An external HTML page: replace the above line with | |
var importantStuff = window.open('http://example.com/waiting.html', '_blank'); | |
// b) Text: add the following line below the above one: |
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 | |
/* Add Custom Fields in Wordpress Post Category */ | |
// the option name | |
define('MY_CATEGORY_FIELDS', 'my_category_fields_option'); | |
// your fields (the form) | |
add_filter('edit_category_form', 'my_category_fields'); | |
function my_category_fields($tag) { | |
$tag_extra_fields = get_option(MY_CATEGORY_FIELDS); |
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 | |
/* Add Custom Fields in Wordpress Category */ | |
// Add term page | |
function tutorialshares_taxonomy_add_new_meta_field() { | |
// this will add the custom meta field to the add new term page | |
?> | |
<div class="form-field"> | |
<label for="term_meta[custom_term_meta]"><?php _e( 'Example meta field', 'tutorialshares' ); ?></label> | |
<input type="text" name="term_meta[custom_term_meta]" id="term_meta[custom_term_meta]" value=""> | |
<p class="description"><?php _e( 'Enter a value for this field','tutorialshares' ); ?></p> |
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 | |
// Add custom column in custom post type (here custom_post = latest_at_sonic) | |
add_filter( 'manage_edit-latest_at_sonic_columns', 'my_edit_latest_at_sonic_columns' ) ; | |
function my_edit_latest_at_sonic_columns( $columns ) { | |
$columns = array( | |
'cb' => '<input type="checkbox" />', | |
'title' => __( 'Title' ), |
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 | |
/* Displaying a Custom Widget Option */ | |
function thmfdn_add_menu_description_option( $widget, $return, $instance ) { | |
// Are we dealing with a nav menu widget? | |
if ( 'nav_menu' == $widget->id_base ) { | |
// Display the description option. | |
$description = isset( $instance['description'] ) ? $instance['description'] : ''; | |
?> |