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
#Leverage browser caching | |
.htaccess code Below :- | |
# Set up caching on static resources for 1 year based on Google recommendations | |
<IfModule mod_expires.c> | |
ExpiresActive On | |
<FilesMatch “\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|js|css|gif|jpg|jpeg|png|swf)$”> | |
ExpiresDefault A29030400 | |
</FilesMatch> | |
</IfModule> | |
# Enable gzip compression |
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 | |
function fb_opengraph() { | |
global $post; | |
if(is_single()) { | |
if(has_post_thumbnail($post->ID)) { | |
$img_src = wp_get_attachment_image_src(get_post_thumbnail_id( $post->ID ), 'medium'); | |
} else { | |
$img_src = get_stylesheet_directory_uri() . '/img/opengraph_image.jpg'; | |
} | |
if($excerpt = $post->post_excerpt) { |
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( 'add_meta_boxes', 'add_events_metaboxes' ); | |
// Add the Events Meta Boxes | |
function add_events_metaboxes() { | |
add_meta_box('wpt_events_location', 'Event Details', 'wpt_events_location', 'post', 'normal', 'high'); | |
} | |
function wpt_events_location() { | |
global $post; | |
// Noncename needed to verify where the data originated |
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( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); | |
function theme_enqueue_styles() { | |
// Get the theme data | |
$the_theme = wp_get_theme(); | |
wp_enqueue_style( 'child-understrap-styles', get_stylesheet_directory_uri() . '/css/child-theme.min.css', array(), $the_theme->get( 'Version' ) ); | |
wp_enqueue_script( 'child-understrap-scripts', get_stylesheet_directory_uri() . '/js/child-theme.min.js', array(), $the_theme->get( 'Version' ), true ); | |
} |
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
function myscript() { | |
?> | |
<script type="text/javascript"> | |
if ( undefined !== window.jQuery ) { | |
// Jquery code goes here | |
} | |
</script> | |
<?php | |
} |
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 | |
function imageUrl($path, $width = NULL, $height = NULL,$quality=NULL,$crop=NULL) { | |
if(!$width && !$height) { | |
$url = env(‘IMAGE_URL’) . $path; | |
} else { | |
$url = url(‘/’) . ‘/timthumb.php?src=’ . env(‘IMAGE_URL’) . $path; |