Skip to content

Instantly share code, notes, and snippets.

View fahdi's full-sized avatar

Fahad Murtaza fahdi

View GitHub Profile
<!-- 1. Take your Campaign Monitor subscribe form as generated from within your account: -->
<form action="http://myaccount.createsend.com/t/r/s/aljhk/" method="post" id="subForm">
<div>
<label for="name">Name:</label><br /><input type="text" name="cm-name" id="name" /><br />
<label for="aljhk-aljhk">Email:</label><br /><input type="text" name="cm-aljhk-aljhk" id="aljhk-aljhk" /><br />
<input type="submit" value="Subscribe" />
</div>
</form>
function display_bulk_discount_table() {
global $woocommerce, $post, $product;
$array_rule_sets = get_post_meta($post->ID, '_pricing_rules', true);
$_regular_price = get_post_meta($post->ID, '_regular_price', true);
if ($array_rule_sets && is_array($array_rule_sets) && sizeof($array_rule_sets) > 0){
$tempstring .= '<div class="bulk-savings-table">';
$tempstring .= '<span>Bulk Savings</span>';
$tempstring .= '<table>';
$tempstring1 .= '<tr><td>Quantity</td>';
$tempstring2 .='<tr><td>Price</td>';
<?php
function read_time($text){
$words = str_word_count(strip_tags($text));
$min = floor($words / 200);
if($min === 0){
return "1 min read";
}
return $min . " min read";
}
<?php
/**
* Plugin Name: Update WP feed to feedburner
* Plugin URI: http://www.wpquestions.com/question/showLoggedIn/id/8997
* Description: Update WP feed URL to feedburner URL
* Version: 0.1
* Author: Fahd Murtaza
* Author URI: http://www.fahdmurtaza.com
* License: GPL2
*/
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title> - jsFiddle demo by fahdi</title>
<script type='text/javascript' src='//code.jquery.com/jquery-1.9.1.js'></script>
@fahdi
fahdi / json_file.json
Last active December 28, 2015 19:49
Update HTML drop down with JSON file with an AJAX request
{ "options": [ {"value": "New1", "text": "New Option 1"}, {"value": "New2", "text": "New Option 2"}, {"value": "New3", "text": "New Option 3"} ] }
@fahdi
fahdi / jscode_for_json.js
Last active December 28, 2015 19:49
Update HTML drop down with data from a JSON variable parsed inline with JSON.parse.
jQuery(function($) {
$("#btnUpdate").click(function() {
data=JSON.parse('{ "options": [ {"value": "New1", "text": "New Option 1"}, {"value": "New2", "text": "New Option 2"}, {"value": "New3", "text": "New Option 3"} ] }');
var options, index, select, option;
// Get the raw DOM object for the select box
select = document.getElementById('theSelect');
@fahdi
fahdi / responsive_images.html
Created November 20, 2013 18:08
Maintaining Image Aspect Ratios in Responsive Web Design. Forked from http://cssdeck.com/labs/rwd-image-aspect-ratio
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Maintain Image Aspect Ratios in RWD</title>
<meta name="robots" content="noindex, nofollow">
<link href="style.css" rel="stylesheet" media="screen">
@fahdi
fahdi / custom.css
Last active December 29, 2015 10:49
Updated code for car/totals.php
/*
WOO CUSTOM STYLESHEET
---------------------
Instructions:
Add your custom styles in this file instead of style.css so it
is easier to update the theme. Simply copy an existing style
from style.css to this file, and modify it to your liking. */
<?php
/**
* The template for displaying Archive pages
*
* Used to display archive-type pages if nothing more specific matches a query.
* For example, puts together date-based pages if no date.php file exists.
*
* If you'd like to further customize these archive views, you may create a
* new template file for each specific one. For example, Twenty Twelve already
* has tag.php for Tag archives, category.php for Category archives, and