Skip to content

Instantly share code, notes, and snippets.

@Shoora
Shoora / A nice contact form
Last active February 28, 2019 03:17 — forked from corsonr/A nice contact form
A nice contact form
<?php
/*
|--------------------------------------------------------------------------
| Form Process
|--------------------------------------------------------------------------
*/
if(isset($_POST['submitted'])) {
if(trim($_POST['contactName']) === '') {
$nameError = 'Please enter your name.';
@Shoora
Shoora / wordpress sitemap
Last active February 28, 2019 04:01 — forked from corsonr/wordpress sitemap
wordpress sitemap html page
<h3>Pages</h3>
<ul><?php wp_list_pages("title_li=" ); ?></ul>
<h3>Feeds</h3>
<ul>
<li><a title="Full content" href="feed:<?php bloginfo('rss2_url'); ?>">Main RSS</a></li>
<li><a title="Comment Feed" href="feed:<?php bloginfo('comments_rss2_url'); ?>">Comment Feed</a></li>
</ul>
<h3>Categories</h3>
<ul><?php wp_list_cats('sort_column=name&optioncount=1&hierarchical=0&feed=RSS'); ?></ul>
<h3>All Blog Posts:</h3>
@Shoora
Shoora / gist:6384400
Last active February 28, 2019 03:41 — forked from daltonrooney/gist:3182528
wordpress dispay page parent
<?php $args = array(
'numberposts' => -1,
'offset' => 0,
'orderby' => 'post_date',
'order' => 'DESC',
'post_type' => 'custom_post_type_here',
'post_status' => 'publish',
'meta_query' => array(
array(
'key' => 'custom_field_key_name',
@Shoora
Shoora / newinstall.php
Last active February 28, 2019 03:51 — forked from ocean90/newinstall.php
Place the file into WordPress root folder and open the file in your browser
<?php
/* Place the file into WordPress root folder and open the file in your browser. */
/* Settings */
define( 'BLOG_TITLE', 'WordPress Dev' );
define( 'USER_NAME', 'admin' );
define( 'USER_EMAIL', 'foobar@example.com' );
define( 'USER_PASSWORD', '123456' );
define( 'WP_SITEURL', 'http://wp.dev' );
@Shoora
Shoora / Continued List Ordering
Last active February 28, 2019 03:36 — forked from trumball/Continued List Ordering
Continued List Ordering
ol.chapters {
list-style: none;
margin-left: 0;
}
ol.chapters > li:before {
content: counter(chapter) ". ";
counter-increment: chapter;
font-weight: bold;
float: left;
@Shoora
Shoora / AutoCacheQueries.js
Last active February 28, 2019 03:35 — forked from pseudosavant/AutoCacheQueries.js
AutoCacheQueries
// jQuery wrapper
var cacheQuery = function(query) {
this.cache = this.cache || {};
if (!this.cache[query]) {
this.cache[query] = jQuery(query);
}
return this.cache[query];
};
@Shoora
Shoora / ua.js
Last active February 15, 2019 00:00 — forked from hatzopoulos/ua.js
Enhanced Link Attribution
// optimized http://mathiasbynens.be/notes/async-analytics-snippet#universal-analytics
(function(G,o,O,g,l){G.GoogleAnalyticsObject=O;G[O]||(G[O]=function(){(G[O].q=G[O].q||[]).push(arguments)});G[O].l=+new Date;g=o.createElement('script'),l=o.scripts[0];g.src='//www.google-analytics.com/analytics.js';l.parentNode.insertBefore(g,l)}(this,document,'ga'));
ga('create','UA-XXXXXXXX', 'auto');
// Enhanced Link Attribution:
// https://developers.google.com/analytics/devguides/collection/analyticsjs/advanced#enhancedlink
// https://support.google.com/analytics/answer/2558867?hl=en
ga('require', 'linkid', 'linkid.js');
@Shoora
Shoora / async_load.js
Last active February 28, 2019 03:35 — forked from devfred/async_load.js
Load javascript resources asynchronously. Accepts additional parameters that can be passed to the specified callback function
/**
* Load javascript resources asynchronously. Accepts additional parameters that can be passed to the specified callback function
* Author: Frederick King
* Date: 3/8/2012
* References/Credits : http://css-tricks.com/thinking-async/ , http://mathiasbynens.be/notes/async-analytics-snippet
*
**/
var async_load_js = function( url, callback ){
var js, args, rs, s;
@Shoora
Shoora / lazy_load.html
Last active February 28, 2019 03:47 — forked from NathanGRomano/lazy_load.html
LazyLoading
<html>
<head>
<title>LazyLoading Test</title>
<script>
var AsyncLoader = function(src, cb) {
var s = document.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = src + '?=' + Math.random(); // make sure we are loading this once
if(typeof(cb) == 'function') {
@Shoora
Shoora / async_load.js
Last active February 28, 2019 03:35 — forked from james2doyle/async_load.js
async_load.js
(function() {
function async_load(){
var s = document.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = 'http://yourdomain.com/script.js';
var x = document.getElementsByTagName('script')[0];
x.parentNode.insertBefore(s, x);
}
if (window.attachEvent) {