Skip to content

Instantly share code, notes, and snippets.

View anwerashif's full-sized avatar
🚩
Coding

Anwer Ashif anwerashif

🚩
Coding
View GitHub Profile
@anwerashif
anwerashif / functions.php
Created February 22, 2018 18:46
Customize the entry meta in the entry header
<?php
// Do NOT include the opening PHP tag
// Customize the entry meta in the entry header
add_filter( 'genesis_post_info', 'bg_entry_meta_header' );
function bg_entry_meta_header( $post_info ) {
// get author details
$entry_author = get_avatar( get_the_author_meta( 'user_email' ), 30 );
@anwerashif
anwerashif / single.php
Created February 6, 2018 13:38
Breadcrumb in Single.php
<!-- breadcrumb -->
<div class="breadcrumb-wrap">
<nav aria-label="breadcrumb">
<?php get_breadcrumb(); ?>
</nav>
</div>
@anwerashif
anwerashif / functions.php
Last active February 22, 2018 18:46
wordpress breadcrumbs
<?php
// Do NOT include the opening PHP tag
/**
* Generate breadcrumbs
*/
function get_breadcrumb() {
echo '<ol class="breadcrumb">';
if (!is_home()) {
echo '<li class="breadcrumb-item">You are here</li>';
@anwerashif
anwerashif / breadcrumb.html
Created February 6, 2018 13:31
bootstrap breadcrumb
<!-- breadcrumb -->
<div class="breadcrumb-wrap"><nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item">You are here</li>
<li class="breadcrumb-item"><a href="#">Home</a></li>
<li class="breadcrumb-item"><a href="#">Blog</a></li>
<li class="breadcrumb-item active" aria-current="page">Blog title here</li>
</ol>
</nav></div>
@anwerashif
anwerashif / functions.php
Last active December 28, 2017 19:02
jQuery Modal Image Function
<?php
// Do NOT include the opening PHP tag
// Load Script
add_action( 'wp_enqueue_scripts', 'selected_option_js' );
function selected_option_js() {
wp_register_script( 'sm-modal-script', get_template_directory_uri() . '/js/modal.js', array( 'jquery' ), '1.0.0', true );
@anwerashif
anwerashif / modal.js
Created December 28, 2017 18:51
jQuery Modal Image
jQuery( document ).ready(function(){
// Add Modal HTML to body
jQuery('body').append( "<div id=\"myModal\" class=\"modal\"><span class=\"close\">&times;</span><img class=\"modal-content\" id=\"img01\"><div id=\"caption\"></div></div>");
// Get the image and insert it inside the modal - use its "alt" text as a caption
jQuery(".img-frm img").on("click", function(){ // Change the class name ".img-frm img" with yours
var image = jQuery(this).attr("src");
var captext = jQuery(this).attr("alt");
jQuery(".modal").css("display","block");
jQuery("#img01").attr("src", image);
@anwerashif
anwerashif / style.css
Created December 28, 2017 18:45
jQuery Modal Image Style
/* Style the Image Used to Trigger the Modal */
.img-frm img { /* Change the class name with yours */
cursor: pointer;
transition: 0.3s;
}
.img-frm img:hover {opacity: 0.7;} /* Change the class name with yours */
/* The Modal (background) */
.modal {
@anwerashif
anwerashif / .htaccess
Created November 20, 2017 15:37
WordPress Speed Optimization via .htaccess
# Disable ETags
<IfModule mod_headers.c>
Header unset ETag
Header set Connection keep-alive
</IfModule>
FileETag None
############## MaxCDN Fix #############
<IfModule mod_headers.c>
<FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|font.css|css|js)$">
@anwerashif
anwerashif / functions.php
Created November 20, 2017 15:26
Remove Query Strings WordPress
<?php
// Do NOT include the opening PHP tag
// Remove Query Strings
function _remove_script_version( $src ){
$parts = explode( '?ver', $src );
return $parts[0];
@anwerashif
anwerashif / .htaccess
Created November 18, 2017 19:36
Enabling Browser Caching via .htaccess
# BEGIN Expire headers
<ifModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 5 seconds"
ExpiresByType image/x-icon "access plus 2592000 seconds"
ExpiresByType image/jpeg "access plus 2592000 seconds"
ExpiresByType image/png "access plus 2592000 seconds"
ExpiresByType image/gif "access plus 2592000 seconds"
ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
ExpiresByType text/css "access plus 604800 seconds"