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
<?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
<?php | |
/* Use mysql parameterized statements rather than simple mysql query to prevent sql injection */ | |
// Connect to MySQLi - Change DB_HOST, DB_USER, DB_PASS, DB_NAME with appropriate values | |
$mysqli = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME) or DIE ('Could not connect to the database:' . mysqli_connect_error()); | |
mysqli_set_charset($mysqli, 'utf-8'); | |
// Change field1 and so on with database fields. | |
$stmt = $dbc->prepare("INSERT INTO database_name (field1, field2, field3, field4, field5) | |
VALUES (?, ?, ?, ?, ?)"); | |
// s = string, i = integer, d = double |
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
<script type="text/javascript"> //Generate current date | |
var currentDate = new Date(); | |
var month = currentDate.getMonth() + 1; | |
var day = currentDate.getDate(); | |
var year = currentDate.getFullYear(); | |
document.write(day + "/" + month + "/" + year); | |
//--> | |
</script> |
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 the below code in main stylesheet */ | |
/* ORANGE background and WHITE font-color */ | |
::-moz-selection { | |
background-color: #FF6200; | |
color: #FFFFFF; | |
} | |
::selection { | |
background-color: #FF6200; | |
color: #FFFFFF; |
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 PHP code to the functions.php of WordPress theme will only display WordPress update notifications to admin users. */ | |
global $user_login; | |
get_currentuserinfo(); | |
if (!current_user_can('update_plugins')) { | |
add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_version_check' );" ), 2 ); | |
add_filter( 'pre_option_update_core', create_function( '$a', "return null;" ) ); | |
} |
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 the following code in .htaccess to protect wp-config.php file from brute force attacks | |
<Files wp-config.php> | |
order allow,deny | |
deny from all | |
</Files> |
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 the following code in .htaccess to protect .htaccess file from brute force attacks | |
<Files .htaccess> | |
order allow,deny | |
deny from all | |
</Files> |
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 | |
// Add the following code in theme's functions.php file to use Gravatar image as favicon (16x16 favicon.ico) | |
function dcg_gravatar_favicon() { | |
// Replace email here | |
$GetEmailHash = md5(strtolower(trim('[email protected]'))); | |
?> | |
<link rel="shortcut icon" href="<?php echo 'http://www.gravatar.com/avatar/' . $GetEmailHash . '?s=16;'; ?>" type="image/x-icon" /> | |
<?php | |
} | |
add_action('wp_head', 'dcg_gravatar_favicon'); |
OlderNewer