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
// Disable plugin deactivation | |
add_filter( 'plugin_action_links', 'slt_lock_plugins', 10, 4 ); | |
function slt_lock_plugins( $actions, $plugin_file, $plugin_data, $context ) { | |
// Remove edit link for all | |
if ( array_key_exists( 'edit', $actions ) ) | |
unset( $actions['edit'] ); | |
// Remove deactivate link for crucial plugins | |
if ( array_key_exists( 'deactivate', $actions ) && in_array( $plugin_file, array( | |
'plugin-folder/plugin-name.php' | |
))) |
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
// hide themes menu in WordPress admin for users other than developer | |
add_action( 'admin_init', 'slt_lock_theme' ); | |
function slt_lock_theme() { | |
global $submenu, $userdata; | |
get_currentuserinfo(); | |
if ( $userdata->ID != 1 ) { | |
unset( $submenu['themes.php'][5] ); | |
unset( $submenu['themes.php'][15] ); | |
} | |
} |
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
// enable svg format file upload | |
add_filter('upload_mimes', 'custom_upload_mimes'); | |
function custom_upload_mimes ( $existing_mimes=array() ) { | |
// add the file extension to the array | |
$existing_mimes['svg'] = 'mime/type'; |
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 | |
/* | |
Template Name: Redirect To First Child | |
*/ | |
if (have_posts()) { | |
while (have_posts()) { | |
the_post(); | |
$pagekids = get_pages("child_of=".$post->ID."&sort_column=menu_order"); | |
$firstchild = $pagekids[0]; | |
wp_redirect(get_permalink($firstchild->ID)); |
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
add_action('admin_menu', 'add_gcf_interface'); | |
function add_gcf_interface() { | |
add_options_page('Opening hours', 'Opening hours', '8', 'functions', 'editglobalcustomfields'); | |
} | |
function editglobalcustomfields() { | |
?> | |
<div class='wrap'> | |
<h2>Opening hours</h2> |
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
/* | |
Make the Facebook Like box responsive (fluid width) | |
https://developers.facebook.com/docs/reference/plugins/like-box/ | |
*/ | |
/* This element holds injected scripts inside iframes that in some cases may stretch layouts. So, we're just hiding it. */ | |
#fb-root { | |
display: none; | |
} |
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
/* --- replace this --*/ | |
<time datetime="<?php echo the_time('Y-m-j'); ?>" pubdate><?php the_date(); ?></time> | |
/* -- with this */ | |
<time datetime="<?php echo the_time('Y-m-j'); ?>" pubdate><?php the_time(get_option('date_format')); ?></time> |
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
/* ------------------------------------------------------------------ajax comments - add to functions.php ------- */ | |
add_action('comment_post', 'ajaxify_comments',20, 2); | |
function ajaxify_comments($comment_ID, $comment_status){ | |
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'){ | |
switch($comment_status){ | |
case "0": | |
wp_notify_moderator($comment_ID); | |
case "1": //Approved comment | |
echo "success"; |
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
/*--- add to functions/custom.php */ | |
/* ---------------------------------- custom pagination for posts -----*/ | |
function j72_pagination($pages = '', $range = 2) | |
{ | |
$showitems = ($range * 2)+1; | |
global $paged; | |
if(empty($paged)) $paged = 1; |