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 | |
/****** | |
Parallelize downloads across hostnames for WordPress. | |
Useful to boost static resources load speed on websites. | |
Recommended by GTmetrix, Pingdom, Google Speed Insights, and others. | |
See full post > https://medium.com/p/32e9dc2fec0c | |
In order to work properly, all subdomains/hostnames MUST have the same structure/path. Ex: | |
http://mydomain.com/wp-content/uploads/2015/11/myimage.jpg |
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 this code in current theme’s functions.php */ | |
/* Replace plugin-directory/plugin-file.php with plugin’s directory and file name */ | |
function filter_plugin_updates( $value ) { | |
unset( $value->response['plugin-directory/plugin-file.php'] ); | |
return $value; | |
} | |
add_filter( 'site_transient_update_plugins', 'filter_plugin_updates' ); |
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
/* ========================================== | |
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
<?php | |
$strContent = file_get_contents('YOUR-XML-FILE-PATH.xml'); // eg. http://www.SomeDomain.com/FileName.xml | |
$arrContent = new SimpleXmlElement($strContent, LIBXML_NOCDATA); | |
?> | |
<p> </p> | |
<div style="margin-left:25px; margin-right: 7px;"> | |
<h2>TITLE GOES HERE</h2> | |
<div> | |
<?php | |
$intI = 0; |
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( 'after_setup_theme', 'themewerx_child_theme_setup' ); | |
function themewerx_child_theme_setup() { | |
remove_shortcode( 'intro_btn_name' ); | |
add_shortcode( 'intro_btn_name', 'themewerx_intro_btn_name' ); | |
} | |
function themewerx_intro_btn_name( $atts, $content = null ) { | |
global $intro_btn; | |
extract( shortcode_atts( array( |
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'], |