Skip to content

Instantly share code, notes, and snippets.

@Integralist
Integralist / remote-git.md
Created February 21, 2012 09:51
Basic set-up of remote git repository on a standard server

Set-up remote git repository on a standard server

The first thing to do is to install Git on the remote server.

Once you do that the rest of the process is split into three sections:

  1. Server set-up
  2. Local set-up (push commits)
  3. Server (pull commits)
@bradvin
bradvin / get_current_post_type.php
Created March 5, 2012 18:48 — forked from mjangda/get_current_post_type.php
Get the current post_type context in the WordPress admin.
<?php
/**
* gets the current post type in the WordPress Admin
*/
function get_current_post_type() {
global $post, $typenow, $current_screen;
//we have a post so we can just get the post type from that
if ( $post && $post->post_type )
return $post->post_type;
@luetkemj
luetkemj / wp-query-ref.php
Last active April 6, 2025 09:15
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
*/
@necolas
necolas / .htaccess
Created April 9, 2012 22:19
Simple, quick way to concatenate, minify, and version static files in a Wordpress theme
# Filename-based cache busting
# taken from https://github.com/h5bp/html5-boilerplate/
# This rewrites file names of the form `name.123456.js` to `name.js`
# so that the browser doesn't use the cached version when you have
# updated (but not manually renamed) the file.
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
@raideus
raideus / my_homepage_scripts.php
Created April 13, 2012 17:12
Register & Enqueue scripts for a particular page (Wordpress)
<?php
function my_homepage_scripts() {
if ( is_front_page() ) {
// jQuery Cycle plugin
wp_register_script( 'jquery-cycle', get_template_directory_uri() . '/js/libs/jquery.cycle.all.js', array( 'jquery' ), '2012-03-13T10:15', false );
wp_enqueue_script( 'jquery-cycle' );
// Custom settings for jQuery Cycle
wp_register_script( 'jquery-cycle-settings', get_template_directory_uri() . '/js/jquery-cycle-settings.js', array( 'jquery-cycle', 'jquery' ), '2012-04-13T10:15', false );
@dongilbert
dongilbert / cycle-base.js
Created April 24, 2012 15:05
jQuery Cycle Base Container
/*
* This is a base container for
* whenever I use jQuery Cycle.
* http://jquery.malsup.com/cycle/
*
* Use this as base HTML
*
* <div id="slider">
* <div id="slides">
* <div class="slide" style="display:block">...</div>
@krogsgard
krogsgard / list-terms-shortcode.php
Created June 24, 2012 23:23
shortcode list taxonomy terms
<?php
/**
* Displays a list of terms for a specific taxonomy.
* Based on Justin Tadlock's [entry-terms] shortcode
* Added attribute to not link to the taxonomy
* using wp_get_object_terms() to do so
*
* @author Brian Krogsgard
*
* @access public
@jcobb
jcobb / gist:2993853
Created June 26, 2012 06:42
Combine multiple WordPress queries
<?php
// An example of creating two separate WP queries, combining the results,
// sorting by date and formatting the results for us in a loop like a regular query.
// order the posts by date in descending order (should go in functions.php to keep things tidy)
function order_by_date( $a, $b )
{
return strcmp( $b->post_date, $a->post_date );
}
@paulruescher
paulruescher / Extend Recent Posts
Created June 26, 2012 19:02
Used this to change the output of WordPress' Recent Posts Widget
/**
* Extend Recent Posts Widget
*
* Adds different formatting to the default WordPress Recent Posts Widget
*/
Class My_Recent_Posts_Widget extends WP_Widget_Recent_Posts {
function widget($args, $instance) {
@johndugan
johndugan / functions.php
Created July 12, 2012 03:14
WordPress: functions.php boilerplate
// ---------------------------------------------------------
// ---------- WordPress functions.php boilerplate ----------
// ---------------------------------------------------------
<?php
// ----------------------------------------------------------------------------
// ---------- Translations can be filed in the /languages/ directory ----------
// ----------------------------------------------------------------------------
load_theme_textdomain( 'html5reset', TEMPLATEPATH . '/languages' );