This file contains 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 hook | |
add_filter( 'wp_nav_menu_objects', 'my_wp_nav_menu_objects_sub_menu', 10, 2 ); | |
// filter_hook function to react on sub_menu flag | |
function my_wp_nav_menu_objects_sub_menu( $sorted_menu_items, $args ) { | |
if ( isset( $args->sub_menu ) ) { | |
$root_id = 0; | |
This file contains 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
//https://stackoverflow.com/questions/18299806/how-to-check-file-mime-type-with-javascript-before-upload/29672957#29672957 | |
// Return the first few bytes of the file as a hex string | |
function getBLOBFileHeader(url, blob, callback) { | |
var fileReader = new FileReader(); | |
fileReader.onloadend = function (e) { | |
var arr = (new Uint8Array(e.target.result)).subarray(0, 4); | |
var header = ""; | |
for (var i = 0; i < arr.length; i++) { | |
header += pad(arr[i].toString(16), 2); |