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
/* ****************** | |
When considering performance speed, you may want to keep JS scripts organized beneath your overall page HTML. | |
This snippet allows most of the DOM to finish loading before running any dynamic scripts. | |
****************** */ | |
function dcg_move_scripts_to_footer() { | |
if( !is_admin() ) { | |
remove_action('wp_head', 'wp_print_scripts'); | |
remove_action('wp_head', 'wp_print_head_scripts', 9); | |
remove_action('wp_head', 'wp_enqueue_scripts', 1); |
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
/* ========================================== | |
Put the following code at the end of wp-config.php file to remove menu or sub-menu page. | |
========================================== */ | |
/* ********* | |
Line 10 will remove menu page of plugin: BackWPup | |
Line 11 will remove Settings menu | |
********* */ | |
function dcg_custom_menu_page_removing() { | |
remove_menu_page( 'backwpup' ); |
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
/* ========================================== | |
Put the following code at the end of wp-config.php file to hide plugin from plugins (list) page. | |
change line 8 with your plugin name. | |
========================================== */ | |
function dcg_hide_plugin_from_dashboard() { | |
global $wp_list_table; | |
$hidearr = array('backwpup/backwpup.php'); | |
$myplugins = $wp_list_table->items; | |
foreach ($myplugins as $key => $val) { |
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
/* | |
* Your Stylesheet | |
* | |
* This stylesheet is loaded when Atom starts up and is reloaded automatically | |
* when it is changed and saved. | |
* | |
* Add your own CSS or Less to fully customize Atom. | |
* If you are unfamiliar with Less, you can read more about it here: | |
* http://lesscss.org | |
*/ |
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
/* Adding this snippet to the functions.php or your wordpress theme will allow you to redirect failed login attempts to any location. */ | |
add_action( 'wp_login_failed', 'dcg_redirect_failed_login' ); | |
function dcg_redirect_failed_login( $username ) { | |
$referrer = $_SERVER['HTTP_REFERER']; | |
if ( !empty($referrer) && !strstr($referrer,'wp-login') && !strstr($referrer,'wp-admin') ) { | |
wp_redirect( $referrer . '?login=failed' ); | |
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
/* ========================================== */ | |
// Add this code to theme's functions.php | |
// It removes the default WordPress feeds and adds your custom feeds to the admin dashboard. | |
/* ========================================== */ | |
function dcg_dashboard_widgets() { | |
global $wp_meta_boxes; | |
// remove unnecessary widgets | |
// var_dump( $wp_meta_boxes['dashboard'] ); // use to get all the widget IDs | |
unset( | |
$wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins'], |
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 ‘Enter Title Here’ Text in WordPress ( http://i.imgur.com/ZAzGY6g.png ) | |
Add the following code in theme's functions.php file. | |
Read more at : http://gajjar.me/1q6ADaI | |
*/ | |
function wpb_change_title_text( $title ){ | |
$screen = get_current_screen(); | |
if ( 'movie' == $screen->post_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 | |
/* Below code will display Google Custom Search results if no posts/results found */ | |
/* Add the below code in theme's search.php file where you want to display results from Google */ | |
$query = get_search_query(); | |
$query_new =str_replace(' ','%20',$query); | |
$url = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&start=0&rsz=8&q=".$query_new; | |
$body = file_get_contents($url); | |
$json = json_decode($body); |
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
/* | |
Change the default role names (Administrator, Editor, Author, Contributor, Subscriber) to any custom names. | |
Add the following code in theme's functions.php file (edit lines 5 and 6 for custom name). | |
*/ | |
function wp_change_role_name() { | |
global $wp_roles; | |
if ( ! isset( $wp_roles ) ) | |
$wp_roles = new WP_Roles(); | |
$wp_roles->roles['contributor']['name'] = 'Owner'; |
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 following code into functions.php of WordPress theme | |
function willhill_text($atts) { | |
extract( shortcode_atts( array( | |
"xmlurl"=>'http://'), | |
$atts | |
) | |
); | |
$str_format = str_replace(array("&","&"), "&", $xmlurl); |