Skip to content

Instantly share code, notes, and snippets.

// Create and array of all parent comments
$parents = array();
foreach ($comments as $cmnt) {
$parents[] = $cmnt->comment_parent;
}
// If the comment ID is in the array of parent above add a class
if ( in_array( $comment->comment_ID, $parents ) ){
$c[] = 'threaded-comment';
}
<?php
// Adds the admin page to the wp-admin navigation
function sv_svn_update_pages() {
add_options_page('SVN Update', 'SVN Update', 8, __FILE__, 'sv_svn_update_page');
}
add_action('admin_menu', 'sv_svn_update_pages');
// Returns array with revision number and path
function sv_template_svn_info() {
$result = array();
<?php
/**
* The base configurations of the WordPress.
*
* This file has the following configurations: MySQL settings, Table Prefix,
* Secret Keys, WordPress Language, and ABSPATH. You can find more information by
* visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
* wp-config.php} Codex page. You can get the MySQL settings from your web host.
*
* This file is used by the wp-config.php creation script during the
Processing WelcomeController#index (for 76.91.13.187 at 2009-11-18 22:35:54) [GET]
Parameters: {"action"=>"index", "controller"=>"welcome"}
NoMethodError (undefined method `length' for nil:NilClass):
app/controllers/application_controller.rb:48:in `find_current_user'
app/controllers/application_controller.rb:42:in `user_setup'
/var/lib/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/rack/request_handler.rb:95:in `process_request'
/var/lib/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
/var/lib/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/railz/application_spawner.rb:378:in `start_request_handler'
/var/lib/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/railz/application_spawner.rb:336:in `handle_spawn_application'
register_sidebar(array('name'=>'Default Sidebar', 'cols'=>1) + $p );
register_sidebar(array('name'=>'Default Inline 2col', 'cols'=>2) + $p );
register_sidebar(array('name'=>'Home Footer 1 2col', 'cols'=>2) + $p );
register_sidebar(array('name'=>'Home Footer 2 2col', 'cols'=>2) + $p );
register_sidebar(array('name'=>'Home Footer 3 2col', 'cols'=>2) + $p );
register_sidebar(array('name'=>'Home Sidebar', 'cols'=>1) + $p );
register_sidebar(array('name'=>'Home Inline 2col', 'cols'=>2) + $p );
register_sidebar(array('name'=>'Post Sidebar', 'cols'=>1) + $p );
register_sidebar(array('name'=>'Page Sidebar', 'cols'=>1) + $p );
register_sidebar(array('name'=>'Topic Sidebar', 'cols'=>1) + $p );
<?php
/**
* @package Twittar - Twitter Avatar for Wordpress
* @author Ricardo Sousa - SmashingMagazine
* @version 1.0
*/
/*
Plugin Name: Twittar
Plugin URI: http://smashingmagazine.com
Description: This is a simple but yet powerful plugin for wordpress that lets you show your users Twitter avatar together with their comments in your website. This is done by matching their mail adress with their twitter account. Works only in public Twitter accounts. Depending of the version if the user has no avatar it will show a default picture that come along with this plugin or gravatar instead.
/*
...
------------------------------------ Style Index-----------------------------------------------
All Structural Changes @group Structure Changes
All Style and Type Changes @group Style and Typography
@sproutventure
sproutventure / gist:172954
Created August 22, 2009 19:35
WP template for redirecting.
<?php
/*
Template name: [Redirect]
// Create a Meta Field named "Redirect" and the value would be the resulting redirect.
*/
?>
<?php wp_head(); ?>
<ul id="pagenav">
<li class="<?php if ( is_home() ) { echo 'current_page_item'; } ?>"><a href="<?php bloginfo('url'); ?>" title="<?php bloginfo('name'); ?>">Home</a></li>
<?php wp_list_pages('sort_column=menu_order&title_li=&exclude=1'); ?>
</ul>
@sproutventure
sproutventure / gist:44466
Created January 7, 2009 21:57
Redmine/Rails email through Gmail SMTP
require "openssl"
require "net/smtp"
Net::SMTP.class_eval do
private
def do_start(helodomain, user, secret, authtype)
raise IOError, 'SMTP session already started' if @started
check_auth_args user, secret if user or secret
sock = timeout(@open_timeout) { TCPSocket.open(@address, @port) }