Skip to content

Instantly share code, notes, and snippets.

View spraveenitpro's full-sized avatar

Praveen spraveenitpro

View GitHub Profile
@spraveenitpro
spraveenitpro / gist:6981186
Last active December 25, 2015 13:09
WordPress Theme Header
/*
Theme Name: Portfolio for SimpleTechLife
Theme URI: http://wptreehouse.com/portfolio-project/
Description: A custom WordPress portoflio site for SimpleTechLife
Author: Praveen
Author URI: http://2hands1world.blogspot.com
Version: 1.0
Tags: clean, light, responsive, two-column, custom-post-types, custom-fields, portfolio
License: GNU General Public License v2.0
@spraveenitpro
spraveenitpro / gist:7822900
Created December 6, 2013 12:23
Virtual Host configuration
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName yourname.dev
DocumentRoot path to custom directory/
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory path to custom directory/>
@spraveenitpro
spraveenitpro / gist:7906530
Created December 11, 2013 07:53
WordPress Gist to display First Name in Registration Form
<?php
add_action('register_form','show_first_name' );
add_action('register_post','check_fields',10,3 );
add_action('user_register','register_extra_fields' );
@spraveenitpro
spraveenitpro / .gitignore
Last active December 31, 2015 17:09
WordPress GitIgnore
# Exclude these files from the git repo
wp-content/backup/*
wp-content/cache/*
wp-content/upgrade/*
wp-content/uploads/*
sitemap.*
wp-config.php
# Hidden system files
*.DS_Store
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName praveen.dev
@spraveenitpro
spraveenitpro / gist:8282016
Last active January 2, 2016 09:19
Adding a URL rewrite to .HTACCESS
1. Enable AllowOverRide in Apache.conf [Ubuntu 13.10] , we have also enabled viewing Indexes and following Symbolic links
<directory /Path to your folder>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</directory>
2.Create a .htaccess in the "/Path to your folder" with the below rewrite rule :
@spraveenitpro
spraveenitpro / gist:8395685
Created January 13, 2014 06:43
Add Search Bar to Header in Wordpress
add_filter('wp_nav_menu_items','add_search_box', 10, 2);
function add_search_box($items, $args) {
ob_start();
get_search_form();
$searchform = ob_get_contents();
ob_end_clean();
if( $args->theme_location == ‘primary-menu’ )
$items .= '<li>' . $searchform . '</li>';
@spraveenitpro
spraveenitpro / Custom Post type
Last active January 3, 2016 02:49
Add a New Custom Post Type Called Book
<?php
/*
Plugin Name: Library Plugin
Author: Praveen selvasekaran
Author URI: hhttp://simpeltechlife.in
Description: The theme to to all themes
Version: 3.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
@spraveenitpro
spraveenitpro / gist:8537545
Created January 21, 2014 10:16
Bootstrap Thumbnail Carousel
<div class="row">
<div class="col-md-12">
<h1>Situations of Concern</h1>
<div id="myCarousel" class="carousel slide">
<!-- Carousel items -->
<div class="carousel-inner">
<div class="item active">
<div class="row">
<div class="col-sm-3"><a href="#x"><img src="http://placehold.it/500x500" alt="Image" class="img-responsive"></a></div>
@spraveenitpro
spraveenitpro / gist:8862016
Created February 7, 2014 12:43
Registering a Sidebar
Functions.php
<?php
if ( function_exists('register_sidebar') ) {
register_sidebar(array(
'name' => 'sidebar',
'id' => 'sidebar',
'description' => 'The default Sidebar',
'before_widget' => '<div class="sidebar-box">',
'after_widget' => '</div>',