Skip to content

Instantly share code, notes, and snippets.

/*
* Shortcode that displays a WordPress Search Form that CAN search a
* specified category
*
* Generally this snippet goes somewhere in functions.php
*/
add_shortcode('search-cat', 'jm_customize_search');
function jm_customize_search($form, $search_text, $button_text) {
$onfocus = " onfocus=\"if (this.value == '$search_text') {this.value = '';}\"";
$onblur = " onblur=\"if (this.value == '') {this.value = '$search_text';}\"";
<?php
/*
Plugin Name: Local Business Microdata Widget
Plugin URI: http://mywpcms.com/local-business-microdata-widget/
Description: A widget that displays business contact info with microdata markup for the Local Business type from Schema.org.
Version: 0.1.0
Author: James Maabadi
Author URI: https://plus.google.com/u/0/+JamesMaabadi/posts
License: GPL2
*/
@jamesmm77
jamesmm77 / agency-pro-genesis-featured-widget-amplified.css
Created December 1, 2013 01:12
Modified home page css from the Agency Pro Genesis child theme for the Genesis Featured Widget Amplified. Replaces lines 1108 to 1286 in the style.css from Agency Pro. Allows you to use the Genesis Featured Widget Amplified in the Home Middle widget of Agency Pro.
@jamesmm77
jamesmm77 / gdoc-csv-html.php
Last active January 3, 2016 17:29
A function that pulls a published public Google Drive Spreadsheet (in csv format) and converts the csv to an html table.
/**
* Show Google Drive CSV as HTML Table - show_gdoc_csv_html_table()
* Parameters:
* (url) - required string of url to published to the web google drive spreadsheet (not just shared) in csv format (&output=csv)
* (table_id) - optional string used for the table's id, appended to data-table-, defaults to 1
* (table_headers) - optional boolean to show first row with Table Headers (<th>), defaults to FALSE
*/
function show_gdoc_csv_html_table($url, $table_id='1', $table_headers=FALSE) {
// generate cache filename from url
@jamesmm77
jamesmm77 / gist:baabb3253ec60811f33c
Created February 25, 2015 18:02
WordPress Leverage Browser Caching
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
@jamesmm77
jamesmm77 / genesis-custom-footer-credits.php
Created April 27, 2015 09:46
Customize the footer credits in a Genesis child theme.
@jamesmm77
jamesmm77 / Adwords Negative Keywords
Last active December 17, 2018 19:20
Lists of Negative Keywords to optimize Adwords Campaings
Misc
--------------------
free
cheap
nude
naked
sex
porn
porno
torrent