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 23, 2018 18:58
Customize Single Post Featured Image and Add Before Entry
<?php
// Do NOT include the PHP opening tag
// Register a custom image size for Singular Featured images
add_image_size( 'singular-featured-thumb', 800, 450, true );
// Display featured image before entry
add_action( 'genesis_before_entry', 'display_featured_image' );
function display_featured_image() {
if ( ! is_singular( array( 'post' ) ) ) {
@anwerashif
anwerashif / functions.php
Created February 23, 2018 18:24
Customize the footer section
<?php
// Do NOT include the PHP opening tag
// Customize the footer section
add_filter('genesis_footer_creds_text', 'bdfg_footer_creds_text');
function bdfg_footer_creds_text($creds) {
global $wpdb;
$table = $wpdb->prefix . 'posts';
$lastDate = date('Y');
$firstDate = $wpdb->get_var("SELECT YEAR(post_date) FROM $table ORDER BY post_date LIMIT 1");
@anwerashif
anwerashif / functions.php
Created February 22, 2018 20:22
Adding Content Before Your Posts
<?php
// Do NOT include PHP opening tag
// Adding Content Before Your Posts
function rs_content() {
if ( is_home( ) )
echo '<div class="before-blog"><h1 class="entry-title blog" itemprop="headline">Premier Publishing Resource</h1>Our Free Resource Helping You with Business Growth Hacking and Revamp WordPress Website</div>';
};
add_action('genesis_before_loop', 'rs_content');
@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 {