Skip to content

Instantly share code, notes, and snippets.

View mohsinr's full-sized avatar

Mohsin Rasool mohsinr

View GitHub Profile
@mohsinr
mohsinr / functions.php
Created October 29, 2015 10:41
Convert Hex Color to RGBa to create Color Shades on the fly
<?php
/* Convert hexdec color string to rgb(a) string */
function hex2rgba($color, $opacity = false) {
$default = 'rgb(0,0,0)';
//Return default if no color provided
if(empty($color))
return $default;
@mohsinr
mohsinr / functions.php
Created October 29, 2015 10:24
Add Excerpts Support for WordPress Pages
<?php
// Add Post Excerpt Support to WordPress Pages
add_action( 'init', 'my_add_excerpts_to_pages' );
function my_add_excerpts_to_pages() {
add_post_type_support( 'page', 'excerpt' );
}
@mohsinr
mohsinr / .htaccess
Last active September 11, 2015 06:55 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/