Skip to content

Instantly share code, notes, and snippets.

View cinghaman's full-sized avatar
🏠
Working from home

Amanpreet Singh cinghaman

🏠
Working from home
View GitHub Profile
@cinghaman
cinghaman / cakephp.htaccess
Created April 27, 2012 07:47
Cakephp .htaccess code
If you have a cakephp installation and want to add additional folders in public_html edit your root .htaccess file with this
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/site.*
RewriteCond %{REQUEST_URI} !-f
RewriteRule (.*) app/webroot/$1 [L]
RewriteCond %{REQUEST_URI} !^/site.*
RewriteCond %{REQUEST_URI} !-d
RewriteRule (.*) app/webroot/$1 [L]
@cinghaman
cinghaman / jquery snippet - populating href
Created August 31, 2012 02:46
Dynamically populating href with jquery
This section goes into your body or where ever you want it to be displayed
<a href="" class="b-template" title="title" Preview</a>
<a href="" class="d-template" title="title" Preview</a>
<a href="" class="p-template" title="title" Preview</a>
<a href="" class="f-template" title="title" Preview</a>
---------------------------------------------------------
This would be added to your header section
@cinghaman
cinghaman / index.html
Created September 1, 2012 21:06
Five lines of jQuery for a paralax scrolling background
<div>
<h1>Paralax effect without a plugin</h1>
<h2>The Odyssey</h2>
<p><cite>By Homer</cite></p>
<p><date>Written 800 B.C.E</date></p>
<p>Tell me, O muse, of that ingenious hero who travelled far and wide after he had sacked the famous town of Troy. Many cities did he visit, and many were the nations with whose manners and customs he was acquainted; moreover he suffered much by sea while trying to save his own life and bring his men safely home; but do what he might he could not save his men, for they perished through their own sheer folly in eating the cattle of the Sun-god Hyperion; so the god prevented them from ever reaching home. Tell me, too, about all these things, O daughter of Jove, from whatsoever source you may know them.</p><p>So now all who escaped death in battle or by shipwreck had got safely home except Ulysses, and he, though he was longing to return to his wife and country, was detained by the goddess Calypso, who had got him into a large cave and wanted to marry him. But as
@cinghaman
cinghaman / gist:43dbb6243487766c8ec3
Created February 3, 2016 23:15
divi child theme css
/*
Theme Name: DemoChild
Theme URI: http://www.elegantthemes.com/gallery/divi/
Version: 1.0.0
Description: Smart. Flexible. Beautiful. Divi is the most powerful theme in our collection.
Author: Elegant Themes
Author URI: http://www.elegantthemes.com
Tags: responsive-layout, one-column, two-columns, three-columns, four-columns, left-sidebar, right-sidebar, custom-background, custom-colors, featured-images, full-width-template, post-formats, rtl-language-support, theme-options, threaded-comments, translation-ready
License: GNU General Public License v2
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@cinghaman
cinghaman / js
Last active August 12, 2016 09:28
On MouseOver change text logo with random text
<script>
jQuery(document).ready(function(t) {
var o = t("#logo"),
n = !1,
s = ["make some noise", "make magic happen", "make yourself heard", "make time for you", "make history", "make it count", "make a bold move", "make mama some money", "make me a drank", "make that hotline bling", "make it rain", "make a difference", "make your dreams real", "make your move", "make it outfuckingstanding", "make it outstanding", "make mashed potatoes", "make connections", "make guacamole", "make your art", "make’m want more", "make success inevitable", "make a leap of faith", "make someone laugh", "make silly faces", "make misteaks mistakes often", "make work you love", "make money, change the world", "make dreams come true", "make peace", "make weird art", "make poo jokes", "make a ruckus", "make coffee", "make more art", "make it simple", "make the internet kinder", "make yourself proud", "make time for what matters", "make fart noises", "make memories", "make some magic", "make make-believe", "
@cinghaman
cinghaman / custom_crumbs.php
Created May 10, 2017 04:50
Modifying WooCommerce Breadcrumbs structure to show home/shop-page/product-name
/**
* Update Breadcrumbs structure
*
*/
/* This function will go inside your child functions.php file of your theme */
function pf_custom_crumbs( $crumbs ) {
$newcrumbs = array();
@cinghaman
cinghaman / social-share.php
Created January 19, 2017 00:51
Create your own social share buttons (use it for WordPress or simple html sites)
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<?php
global $post;
$post_url = get_permalink();
$post_title = str_replace( '', '%20', get_the_title() );
$post_thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( $post ->ID ), 'full' );
//share URL's
$twitter_url = 'https://twitter.com/intent/tweet?text='.$post_title.'&amp;url='.$post_url.'&amp;via=twitter_id';
@cinghaman
cinghaman / scripts-to-head.php
Created May 23, 2018 13:22
WordPress Plugin Default code
<?php
/**
* Plugin Name: Scripts to Head
* Plugin URI: https://thepartytraveller.com
* Description: Add Scripts to head without any other noise
* Version: 1.0
* Author: Robin
* Author URI: https://thepartytraveller.com
*/
@cinghaman
cinghaman / functions.php
Last active July 13, 2018 16:18
Remove dashicons script for non logged in users - WordPress
// Add it in the end of your functions.php file in the child theme
// Remove dashicons in frontend for unauthenticated users
add_action( 'wp_enqueue_scripts', 'rs_dequeue_dashicons' );
function rs_dequeue_dashicons() {
if ( ! is_user_logged_in() ) {
wp_deregister_style( 'dashicons' );
}
}
@cinghaman
cinghaman / gist:008e4874ed4ceb33fd3f
Created March 26, 2016 15:51
Trying to convert bootstrap wp-navwalker to have a accordion menu instead of dropdwn line 24 and 85 needs to be dynamic
<?php
/**
* Class Name: wp_bootstrap_navwalker
* GitHub URI: https://github.com/twittem/wp-bootstrap-navwalker
* Description: A custom WordPress nav walker class to implement the Bootstrap 3 navigation style in a custom theme using the WordPress built in menu manager.
* Version: 2.0.4
* Author: Edward McIntyre - @twittem
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt