Skip to content

Instantly share code, notes, and snippets.

View disable-access-to-files.txt
To block readme.html add this to .htaccess file:
<files readme.html>
order allow,deny
deny from all
Repeat it for other files as needed.
View remove-version.php
/*remove wordpress version number from front-end pages*/
function remove_version_from_mysite() {
return '';
View add-honeypot-wordpress-comment-form.php
This code adds a hidden text field to the comment form to trap spam bots.
Add these code snippet at the end of functions.php.
No other setting needed.
//Add an invisible field to comment form box
add_action('comment_form', 'wpp_add_honeypot');
function wpp_add_honeypot($postID) {
View remove-comment-form-url.php
//* Remove Comment Form Website URL Field
function wpp_remove_comment_url($fields) {
return $fields;
//* Remove comment form allowed tags
add_filter( 'comment_form_defaults', 'wpp_remove_comment_form_allowed_tags' );
function wpp_remove_comment_form_allowed_tags( $defaults ) {
View include-files-child-theme.php
/*Include a file from Child Theme Directory*/
<?php require_once( get_stylesheet_directory(). '/functions/child_theme_include_file.php' ); ?>
/*Include a file from Parent Theme Directory*/
<?php require_once( get_template_directory(). '/functions/parent_theme_include_file.php' ); ?>
/*Include a image from Child Theme Directory*/
<img src="<?php echo get_stylesheet_directory_uri(); ?>/images/my_picture.png" alt="" />
View child-theme-style.css
Theme Name: Twenty Fifteen Child
Theme URI:
Description: Child theme for the Twenty Fifteen theme
Author: Your name here
Author URI:
Template: twentyfifteen
Version: 0.1.0
vijujohns / site-plugin.php
Last active Aug 29, 2015
Create a site specific plugin to host your local functions that can be enabled or disabled any time.
View site-plugin.php
Plugin Name: Site Plugin for
Version: 1.0
Author: Your Name
Description: Custom functions for
/* Start Adding Functions Below this Line */
View auto-insert-adsense-ad-to-top-left-or-right-of-post-content.php
//Automatically Insert Google Adsense ads to the top left or right of each post content.
add_filter( 'the_content', 'wpp_insert_ads_to_content' );
function wpp_insert_ads_to_content( $content ) {
$ad_code_wrapper_start = '<div style=”display:block;float:right;margin: 0px 0px 0px 10px;”>';
$ad_code = ' Copy and Paste Ad sense code here. Do not remove the starting and ending single quotes ';
$ad_code_wrapper_end = '</div>';
View include-125x125-ad.html
<div style="float:right;position:relative;left:-50%;text-align:center;">
<div style="position:relative;left:50%;">
<!--125x125 Ad Banner#1-->
<a href="target link here" target=_blank>
<img src="File URL of ad banner image here" alt="alt txt for ad 1" width="125" height="125" rel="nofollow" />
<!--125x125 Ad Banner#2-->
<a href="target link here" target=_blank>
vijujohns / 125x125 Ads.html
Last active Aug 29, 2015
Include responsive 125x125 Ad space in your WordPress blog sidebar without any plugin -
View 125x125 Ads.html
<div style="float:right;position:relative;left:-50%;text-align:center;">
<div style="position:relative;left:50%;">
<!--125x125 Ad Banner Block#1-->
<a href="" target=_blank>
<img src="http://localhost/wp-content/uploads/2015/07/a.png" alt="Google Banner" width="125" height="125" rel="nofollow" />
<!--125x125 Ad Banner Block#2-->
<a href="" target=_blank>