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_filter( 'woocommerce_product_tabs', 'woo_rename_tabs', 98 ); | |
function woo_rename_tabs( $tabs ) { | |
$tabs['description']['title'] = __( 'More Information' ); // Rename the description tab | |
$tabs['reviews']['title'] = __( 'Ratings' ); // Rename the reviews tab | |
$tabs['additional_information']['title'] = __( 'Product Data' ); // Rename the additional information tab | |
return $tabs; | |
} |
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
// remove redundant "description" heading from description tab | |
add_filter( 'woocommerce_product_description_heading', 'remove_product_description_heading' ); | |
function remove_product_description_heading() { | |
return ''; | |
} |
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 admin menus in sidebar | |
function remove_menu_items() { | |
global $menu; | |
$restricted = array(__('Dashboard'), __('Pages') , __('Posts'), __('Comments'), __('Media'), __('Plugins'), __('Appearance'), __('Settings'), __('Tools'), __('Users')); | |
end ($menu); | |
while (prev($menu)){ | |
$value = explode(' ',$menu[key($menu)][0]); | |
if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){ | |
unset($menu[key($menu)]);} |
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> |
NewerOlder