Skip to content

Instantly share code, notes, and snippets.

<?php /* response to question 2059 on wpquestions.com from jlannigan (julianlannigan.com) */ ?>
<div class="subscribe clearfix">
<h3>
<a href="<?php echo home_url("/?feed=rss"); ?>">
<img class="i_rss" alt="" src="<?php echo home_url("/wp-content/themes/GeoPlaces/images/i_rss.png"); ?>">
</a>
</h3>
<form name="ccoptin" action="http://oi.vresp.com?fid=f630be0279" target="vr_optin_popup" method="post" class="subscribe_form" onsubmit="window.open( 'http://www.verticalresponse.com', 'vr_optin_popup', 'scrollbars=yes,width=600,height=450' ); return true;">
<p>Your Email</p>
<input type="text" value="" name="email" class="field">
@mrlannigan
mrlannigan / gist:945978
Created April 28, 2011 07:44
WPquestions.com #2150 rev3
<?php //answer to wpquestions.com #2150 by Julian Lannigan (julianlannigan.com)
function article_series() {
global $post;
$series = get_post_meta($post->ID, 'edit_cat', true);
$currentPost = $post;
if ($series) {
$args = array(
'numberposts' => 5,
@mrlannigan
mrlannigan / gist:947141
Created April 28, 2011 19:37
WPquestions.com #2143 rev1
<?php // answer to wpquestions.com #2143 by Julian Lannigan (julianlannigan.com)
function override_logout_form() {
wp_logout();
$logoutDestination = '/';
$redirect_to = !empty($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : $logoutDestination;
wp_safe_redirect($redirect_to);
exit();
}
add_action('login_form_logout', 'override_logout_form');
@mrlannigan
mrlannigan / gist:972433
Created May 14, 2011 17:46
WPquestions.com #2245 rev1
<?php // answer to wpquestions.com #2245 by Julian Lannigan (julianlannigan.com)
// GET THE DATA
$customFieldName = 'event_date';
$outputData = array();
$currentDate = time();
$queryArgs = array(
'posts_per_page' => -1,
'meta_query' => array(
@mrlannigan
mrlannigan / gist:972950
Created May 15, 2011 07:38
WPquestions.com #2235 rev1
<?php // answer to wpquestions.com #2235 by Julian Lannigan (julianlannigan.com)
function coauthor_add_to_wardrobe_link() {
$currentUrl = "http".(($_SERVER["HTTPS"] == "on") ? "s" : "")."://".$_SERVER["SERVER_NAME"].(($_SERVER["SERVER_PORT"] != "80") ? ":".$_SERVER["SERVER_PORT"] : "").$_SERVER["REQUEST_URI"]; //Gets current page url
if (defined('COAUTHORS_PLUS_VERSION')) {
global $current_user;
if (is_user_logged_in()) {
//Check if they have requested to be an author
if (isset($_REQUEST['addToWardrobe']) && is_numeric($_REQUEST['addToWardrobe']) && $_REQUEST['addToWardrobe'] > 0) {
if (!is_coauthor_for_post($current_user->user_login, $_REQUEST['addToWardrobe'])) {
$cAuthors = array();
@mrlannigan
mrlannigan / gist:1012138
Created June 7, 2011 12:29
WPquestions.com #2394 rev1
<?php
/**** ADD FB IMAGES***/
//Adding the Open Graph in the Language Attributes
function add_opengraph_doctype( $output ) {
return $output . ' xmlns:og="http://opengraphprotocol.org/schema/" xmlns:fb="http://www.facebook.com/2008/fbml"';
}
add_filter('language_attributes', 'add_opengraph_doctype');
//Lets add Open Graph Meta Info
@mrlannigan
mrlannigan / wpq_plain_text.js
Created June 13, 2011 08:04
WPquestions Plain Text jQuery Plugin
The plain text icon used can be downloaded from:
http://www.iconfinder.com/icondetails/9091/128/plain_text_icon
I used the 16x16 version of the above.
@mrlannigan
mrlannigan / gist:1409150
Created November 30, 2011 13:59
Custom Query Plugin Help for oomskaap
<?php
function register_price() {
$direction = "DESC"; //Default direction
if (isset($_GET["order_dir"]) && $_GET["order_dir"] == "ASC") {
$direction = "ASC";
}
register_custom_queryable_field("price", array("dataType" => "numeric", "order" => $direction));
}
?>
var fs = require("fs");
var logPath = "C:\\wamp\\www\\sandbox\\node\\gigya\\log";
var dates = {};
fs.readdir(logPath, function(err, files) {
files.forEach(function(i) {
var m = i.match(/([0-9]+)/gi);
if (typeof dates[m[0]] == "undefined") dates[m[0]] = [];
{
"cmd": ["bin/run_dev_debug.sh", "/usr/local/bin/node", "bootstrap.js"],
"selector": "source.js",
"working_dir": "/Users/Julian/Work/boomerang",
"path": "/usr/local/bin/"
}