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 | |
function haysky_disable_admin_bar() { | |
if (current_user_can('administrator') ) { | |
show_admin_bar(true); | |
} else { | |
show_admin_bar(false); | |
} | |
} | |
add_action('after_setup_theme', 'haysky_disable_admin_bar'); |
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_action( 'init', function() { | |
if ( is_admin() && ! current_user_can( 'administrator' ) && is_user_logged_in() && ! wp_doing_ajax() ) { | |
wp_redirect( home_url().'/account' ); | |
exit; | |
} | |
}); |
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 | |
/*** Sort and Filter Users ***/ | |
add_action('restrict_manage_users', 'filter_by_gender'); | |
function filter_by_gender($which){ | |
// template for filtering | |
$st = '<select name="gender_%s" style="float:none;margin-left:10px;"> | |
<option value="">%s</option>%s</select>'; | |
// generate options |
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_filter('manage_users_columns','remove_users_columns'); | |
function remove_users_columns($column_headers) { | |
// if (current_user_can('moderator')) { | |
unset($column_headers['name']); | |
// } | |
return $column_headers; | |
} |
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_action( 'wp_enqueue_scripts',function(){ | |
global $post; | |
if( is_a( $post, 'WP_Post' ) && has_shortcode( $post->post_content, 'mathematics_exam') ) { | |
wp_enqueue_script( 'jquery'); | |
} | |
}); |
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 | |
function ws_preselect_post_category() { | |
if ( isset($_GET['category']) && is_numeric($_GET['category']) ) { | |
$catId = intval($_GET['category']); | |
?> | |
<script type="text/javascript"> | |
jQuery(function() { | |
var catId = <?php echo json_encode($catId); ?>; | |
jQuery('#in-category-' + catId).click(); | |
}); |
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
<script> | |
if ( window.history.replaceState ) { | |
window.history.replaceState( null, null, window.location.href ); | |
} | |
</script> |
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
<a href="upi://pay?pa=9999999999@upi&pn=SHAIK MOHAMMAD SUFYAN&am=200&cu=INR">CLICK HERE</a> | |
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
<script type="text/javascript"> | |
function download(filename, text) { | |
var element = document.createElement('a'); | |
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); | |
element.setAttribute('download', filename); | |
element.style.display = 'none'; | |
document.body.appendChild(element); | |
element.click(); |
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
<input type="file" id="imageUpload" onchange="previewImage()"> | |
<div id="imagePreview"></div> | |
<script type="text/javascript"> | |
function previewImage() { | |
var preview = document.getElementById('imagePreview'); | |
img = document.getElementById('imageUpload').files[0]; | |
var reader = new FileReader(); | |
if (img) { | |
reader.readAsDataURL(img); | |
} else { |
OlderNewer