Skip to content

Instantly share code, notes, and snippets.

@ericjuden
ericjuden / wordpress-options.php
Created February 8, 2013 15:49
WordPress Options Class
<?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 / functions.php
Last active September 3, 2020 13:07
Taxonomy Dropdown Control for WordPress Theme Customizer
<?php
add_action('customize_register', 'my_customize_register');
function my_customize_register($wp_customize){
require_once(TEMPLATEPATH . '/class/wp_customizer_taxonomy_dropdown.php');
$wp_customize->add_section('my_theme_blog_featured_categories', array(
'title' => __('Blog: Featured Categories'),
'priority' => 36,
));
@ericjuden
ericjuden / edit-author-name.php
Created January 28, 2013 14:52
Edit Post Author Name in WordPress Feeds
<?php
function my_rss2_ns(){
global $in_rss_feed;
$in_rss_feed = true;
}
add_action('rss2_ns', 'my_rss2_ns');
function my_the_author($author){
global $in_rss_feed;
@ericjuden
ericjuden / my-object-oriented-plugin.php
Created January 28, 2013 14:40
Object-Oriented Plugin for WordPress boilerplate
<?php
/**
* Plugin Name: My Object-Oriented Plugin
* Plugin URI: Plugin Website Here
* Description: Your Description Here
* Author: Your Name Here
* Author URI: Your Website Here
* Version: 1.0
*/
@ericjuden
ericjuden / speak-pirate.php
Created January 28, 2013 14:34
Speak Pirate plugin for WordPress
<?php
/**
* Plugin Name: Speak Pirate
* Plugin URI:
* Description: translates text in a shortcode into the equivalent text spoken as a pirate
* Author: ericjuden
* Author URI: http://ericjuden.com
* Version: 1.0
*/
@ericjuden
ericjuden / gridview_with_rank.aspx.cs
Last active December 11, 2015 20:29
ASP.NET/C# GridView Rank column
public partial class Leaders : System.Web.UI.Page {
private int rank = 0; // Rank of the current record in GridView
private int currentPage = 0; // tracks current page in GridView
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) {
// Find label control to update
Label lblRank = (Label)e.Row.FindControl("lblRank");
// On page reload, rank is reset to 0
if (rank == 0) {