Skip to content

Instantly share code, notes, and snippets.

@ericjuden
ericjuden / list-blogs.php
Created May 15, 2013 11:55
WordPress Multisite: List Blogs
<?php if(is_front_page()){ ?>
<h1>Blog Directory</h1>
<?php
global $wpdb;
$query = "SELECT blog_id FROM " . $wpdb->base_prefix . "blogs WHERE spam != '1' AND archived != '1' AND deleted != '1' AND public = '1' AND blog_id != '1' ORDER BY path";
$blogs = $wpdb->get_results($query);
echo '<ul>';
@ericjuden
ericjuden / list-blogs-alpha.php
Created May 15, 2013 12:56
WordPress Multisite: List Blogs Alphabetically
<?php if(is_front_page()){ ?>
<h1>Blog Directory</h1>
<?php
global $wpdb;
$aBlogs = array();
$query = "SELECT blog_id FROM " . $wpdb->base_prefix . "blogs WHERE spam != '1' AND archived != '1' AND deleted != '1' AND public = '1' AND blog_id != '1' ORDER BY path";
$blogs = $wpdb->get_results($query);
@ericjuden
ericjuden / Microsoft.PowerShell_profile.ps1
Created January 28, 2014 22:50
Search for .ps1 files in a given directory
# Search for .ps1 files in a given directory
Get-ChildItem C:\Code\powershell -Include *.ps1 -Recurse -Force | % { . $_.FullName }
@ericjuden
ericjuden / wordpress-options-json.php
Last active June 30, 2022 12:33
WordPress Options Class with Support for storing and retrieving JSON
<?php
class My_Plugin_Options {
var $options;
var $option_name;
var $is_site_option; // Are we using Multisite and saving to global options?
function My_Plugin_Options($option_name, $is_site_options = false){
$this->option_name = $option_name;
$this->is_site_option = $is_site_options;
if($this->is_site_option){
@ericjuden
ericjuden / jquery-image-resize.js
Created March 3, 2014 21:16
JQuery Image Resize
$(document).ready(function() {
$('.story-small img').each(function() {
var maxWidth = 100; // Max width for the image
var maxHeight = 100; // Max height for the image
var ratio = 0; // Used for aspect ratio
var width = $(this).width(); // Current image width
var height = $(this).height(); // Current image height
// Check if the current width is larger than the max
if(width > maxWidth){
<?php
$args = array(
'post_type' => 'services'
);
$the_query = new WP_query( $args );
?>
<?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post() ;?>