This file contains hidden or 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
if ( !defined('SAVEQUERIES') && isset($_GET['debug']) && $_GET['debug'] == 'sql' ) | |
define('SAVEQUERIES', true); | |
if ( !function_exists('dump') ) : | |
/** | |
* dump() | |
* | |
* @param mixed $in | |
* @return mixed $in | |
**/ |
This file contains hidden or 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 META BOXES FROM DEFAULT POSTS SCREEN | |
function remove_default_post_screen_metaboxes() { | |
remove_meta_box( 'postcustom','post','normal' ); // Custom Fields Metabox | |
remove_meta_box( 'postexcerpt','post','normal' ); // Excerpt Metabox | |
remove_meta_box( 'commentstatusdiv','post','normal' ); // Comments Metabox | |
remove_meta_box( 'trackbacksdiv','post','normal' ); // Talkback Metabox | |
remove_meta_box( 'slugdiv','post','normal' ); // Slug Metabox | |
remove_meta_box( 'authordiv','post','normal' ); // Author Metabox | |
} | |
add_action('admin_menu','remove_default_post_screen_metaboxes'); |
This file contains hidden or 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
// Set the post revisions unless the constant was set in wp-config.php | |
if (!defined('WP_POST_REVISIONS')) define('WP_POST_REVISIONS', 5); |
This file contains hidden or 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
// delay feed update | |
function publish_later_on_feed($where) { | |
global $wpdb; | |
if (is_feed()) { | |
// timestamp in WP-format | |
$now = gmdate('Y-m-d H:i:s'); | |
// value for wait; + device | |
$wait = '10'; // integer |
This file contains hidden or 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
// spam & delete links for all versions of wordpress | |
function delete_comment_link($id) { | |
if (current_user_can('edit_post')) { | |
echo '| <a href="'.get_bloginfo('wpurl').'/wp-admin/comment.php?action=cdc&c='.$id.'">del</a> '; | |
echo '| <a href="'.get_bloginfo('wpurl').'/wp-admin/comment.php?action=cdc&dt=spam&c='.$id.'">spam</a>'; | |
} | |
} |
This file contains hidden or 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 version info from head and feeds | |
function complete_version_removal() { | |
return ''; | |
} | |
add_filter('the_generator', 'complete_version_removal'); |
This file contains hidden or 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
// even more smart jquery inclusion :) | |
add_action( 'init', 'jquery_register' ); | |
// register from google and for footer | |
function jquery_register() { | |
if ( !is_admin() ) { | |
wp_deregister_script( 'jquery' ); | |
wp_register_script( 'jquery', ( 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js' ), false, null, true ); |
This file contains hidden or 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 CUSTOM POST TYPES SEARCHABLE | |
function searchAll( $query ) { | |
if ( $query->is_search ) { $query->set( 'post_type', array( 'site', 'plugin', 'theme', 'person' ) ); } | |
return $query; | |
} | |
add_filter( 'the_search_query', 'searchAll' ); | |
// ADD CUSTOM POST TYPES TO THE DEFAULT RSS FEED | |
// Add your custom post types to your sites main RSS feed by default. | |
function custom_feed_request( $vars ) { |
This file contains hidden or 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
// This code will allow you to easily modify the WordPress Login page Logo as well as the href link and title text of this logo. | |
add_filter( 'login_headerurl', 'namespace_login_headerurl' ); | |
/** | |
* Replaces the login header logo URL | |
* | |
* @param $url | |
*/ | |
function namespace_login_headerurl( $url ) { | |
$url = home_url( '/' ); |
This file contains hidden or 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
// CUSTOM ADMIN MENU LINK FOR ALL SETTINGS | |
// This little piece of code does something pretty cool. It will add an additional option to your settings menu with a link to "all settings" which will show you a complete list of all the settings you have within your database related to your wordpress site. The code below will only made this link visible to an admin user and hide it for all other users. | |
function all_settings_link() { | |
add_options_page(__('All Settings'), __('All Settings'), 'administrator', 'options.php'); | |
} | |
add_action('admin_menu', 'all_settings_link'); |