Skip to content

Instantly share code, notes, and snippets.

@luetkemj
luetkemj / wp-query-ref.php
Last active April 25, 2024 09:37
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@aslan144
aslan144 / call jquery slide show method
Created March 15, 2012 23:16 — forked from abedsujan/call jquery slide show method
Read All Images from a folder And display slide show.
<script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>
<script src="jquery.innerfade.js" type="text/javascript"></script>
<script>
$(document).ready(function() {
$('#image_rotate').innerfade({
speed: 'slow',
timeout: 2000,
type: 'sequence',
containerheight: '220px'
});
@j3ffgray
j3ffgray / ffffound.com.js
Created March 30, 2012 21:24
Pinterested ffffound using dotjs
/**
* jQuery Masonry v2.1.03
* A dynamic layout plugin for jQuery
* The flip-side of CSS Floats
* http://masonry.desandro.com
*
* Licensed under the MIT license.
* Copyright 2011 David DeSandro
*/
(function(a,b,c){"use strict";var d=b.event,e;d.special.smartresize={setup:function(){b(this).bind("resize",d.special.smartresize.handler)},teardown:function(){b(this).unbind("resize",d.special.smartresize.handler)},handler:function(a,b){var c=this,d=arguments;a.type="smartresize",e&&clearTimeout(e),e=setTimeout(function(){jQuery.event.handle.apply(c,d)},b==="execAsap"?0:100)}},b.fn.smartresize=function(a){return a?this.bind("smartresize",a):this.trigger("smartresize",["execAsap"])},b.Mason=function(a,c){this.element=b(c),this._create(a),this._init()},b.Mason.settings={isResizable:!0,isAnimated:!1,animationOptions:{queue:!1,duration:500},gutterWidth:0,isRTL:!1,isFitWidth:!1,containerStyle:{position:"relative"}},b.Mason.prototype={_filterFindBricks:function(a){var b=this.options.itemSelector;return b?a.filter
@evansolomon
evansolomon / gist:2274120
Created April 1, 2012 09:36
nginx WordPress multisite config
server {
listen 80 default_server;
server_name domain.com *.domain.com;
root /srv/www/domain.com/public;
access_log /srv/www/domain.com/log/access.log;
error_log /srv/www/domain.com/log/error.log;
location / {
index index.php;
@rnagle
rnagle / otf_get_attachment_image_src.php
Created April 12, 2012 12:46
WordPress: Generate thumbnails on-the-fly
<?php
/*
* Check for thumb of $size and generate it if it doesn't exist.
*
* @param int $post_id Post ID for which you want to retrieve thumbnail
* @param string $size Name of thumbnail size to check for; same as
* the slug used to add custom thumb sizes with add_image_size().
* @return array An array containing: array( 0 => url, 1 => width, 2 => height )
*
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@foxinni
foxinni / better wp_dropdown_categories() for taxonomies
Created June 13, 2012 07:47
Modify wp_dropdown_categories() to support taxonomy->slug in select output, and not taxonomy->id.
<?php
/*
Background: My company post type needed a filter added via the 'restrict_manage_posts' action, and I needed to modify the wp_dropdown_categories to output the taxonomy slug into the <option value="..."> instead of the taxonomy ID. The taxonomy being 'industry'.
The SH_Walker_TaxonomyDropdown() can be found here: https://gist.github.com/2902509
*/
function restrict_listings_by_taxonomy() {
global $typenow;
global $wp_query;
@Abban
Abban / WordPress Theme Customizer Sample.php
Created June 21, 2012 21:09
WordPress Theme Customizer Sample
<?php
function themename_customize_register($wp_customize){
$wp_customize->add_section('themename_color_scheme', array(
'title' => __('Color Scheme', 'themename'),
'priority' => 120,
));
// =============================
anonymous
anonymous / index.php
Created July 5, 2012 17:20
WP Query loop - in multiples of 3 posts in containing div.
<?php
$currentID = get_the_ID();
$featured = new WP_Query(array(
'post_type' => 'post',
'order' => 'DESC',
'posts_per_page' => 8,
'post__not_in' => array($currentID)
@Adirael
Adirael / fix-wordpress-permissions.sh
Created August 17, 2012 23:16
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory