Skip to content

Instantly share code, notes, and snippets.

View jamalkhan2k6's full-sized avatar

Jamal Khan jamalkhan2k6

View GitHub Profile
<!-- participant_country_flag -->
<script>
var isoCountries = {'AF' : 'Afghanistan', 'AX' : 'Aland Islands', 'AL' : 'Albania', 'DZ' : 'Algeria', 'AS' : 'American Samoa', 'AD' : 'Andorra', 'AO' : 'Angola', 'AI' : 'Anguilla', 'AQ' : 'Antarctica', 'AG' : 'Antigua And Barbuda', 'AR' : 'Argentina', 'AM' : 'Armenia', 'AW' : 'Aruba', 'AU' : 'Australia', 'AT' : 'Austria', 'AZ' : 'Azerbaijan', 'BS' : 'Bahamas', 'BH' : 'Bahrain', 'BD' : 'Bangladesh', 'BB' : 'Barbados', 'BY' : 'Belarus', 'BE' : 'Belgium', 'BZ' : 'Belize', 'BJ' : 'Benin', 'BM' : 'Bermuda', 'BT' : 'Bhutan', 'BO' : 'Bolivia', 'BA' : 'Bosnia and Herzegovina', 'BW' : 'Botswana', 'BV' : 'Bouvet Island', 'BR' : 'Brazil', 'IO' : 'British Indian Ocean Territory', 'BN' : 'Brunei Darussalam', 'BG' : 'Bulgaria', 'BF' : 'Burkina Faso', 'BI' : 'Burundi', 'KH' : 'Cambodia', 'CM' : 'Cameroon', 'CA' : 'Canada', 'CV' : 'Cape Verde', 'KY' : 'Cayman Islands', 'CF' : 'Central African Republic', 'TD' : 'Chad', 'CL' : 'Chile', 'CN' : 'China', 'CX' : 'Christmas Island',
add_action( 'init', 'redirect_sub_callback' );
function redirect_sub_callback() {
if ( is_admin() && current_user_can( 'subscriber' ) && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) )
{
wp_redirect( home_url() );
exit;
}
}
function jmapplic_link_post($location) {
$country = $location->title;
$users = jGetMembersByCountry($country);
$count = 1;
foreach($users as $post) {
//$link = get_the_permalink($post->ID);
//$inst = get_post_meta($post->ID, "participant-institution", true);
<?php
function jmapplic_link_post($location) {
$country = $location->title;
$users = jGetMembersByCountry($country);
$count = 1;
foreach($users as $post) {
$link = get_the_permalink($post->ID);
$inst = get_post_meta($post->ID, "participant-institution", true);
add_filter('wp_insert_post_data', 'mandatory_excerpt', 10, 1);
function mandatory_excerpt($data) {
//flipbooks is the custom post type, change it to yours
if ( 'flipbooks' != $data['post_type'] ) {
return $data;
} else {
$excerpt = $data['post_excerpt'];
function filemanager_restrict_mimes( $opts, $folder ) {
foreach ($opts["roots"] as $key => $root) {
$opts["roots"][$key]['uploadAllow'] = array('image/gif', 'image/png');
$opts["roots"][$key]['uploadDeny'] = array('application/pdf');
}
return $opts;
}
add_filter( 'red_fm_opts', 'filemanager_restrict_mimes', 10, 2 );
<?php
//filemanager version 7.X
defined('ABSPATH') or die("Cannot access pages directly.");
error_reporting(0); // Set E_ALL for debuging
//error_reporting(E_ALL | E_STRICT); // Set E_ALL for debuging
ini_set('max_file_uploads', '50'); // allow uploading up to 50 files at once
ini_set("upload_max_filesize","9G");
// needed for case insensitive search to work, due to broken UTF-8 support in PHP
.elfinder-col-kind, .elfinder-col-perm, .elfinder-col-size{
display:none !important;
}
#elfinder-elfinder-cwd-thead > tr td:nth-child(2){
display:none !important;
}
#elfinder-elfinder-cwd-thead > tr td:nth-child(5){
@jamalkhan2k6
jamalkhan2k6 / settings.php
Created May 20, 2020 11:04
Filemanager hide root folder from the admin panel and only show a subfolders instead of the wordpress root folder
<?php
// error_reporting(0);
defined('ABSPATH') or die("Cannot access pages directly.");
$folder_depth = get_option("red_fm_folder_depth") ? get_option("red_fm_folder_depth") : 3;
//you can add a subfolder inside the root to only show that folder and subfolders in the admin panel, add / at the end; ex: wp-content/
define('FM_SUB_FOLDER', "wp-content/"); //only show wp-content and its subfolders
define('FM_ALLOW_ROOT', false); //hide root folder
define('FILE_LEVELS', $folder_depth);