Skip to content

Instantly share code, notes, and snippets.

@mbeall
mbeall / sparks_nav_menu.php
Last active December 11, 2015 07:58
Class sparks_nav_menu adds ?ref=menu to menu links when called by the wp_nav_menu() function
<?php
class sparks_nav_menu extends Walker_Nav_Menu {
function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
$class_names = $value = '';
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
$classes[] = 'menu-item-' . $item->ID;
@mbeall
mbeall / sparks_side_menu.php
Created January 19, 2013 00:37
Class sparks_side_menu adds ?ref=side to menu links when called by the wp_nav_menu() function
<?php
class sparks_side_menu extends Walker_Nav_Menu {
function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
$class_names = $value = '';
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
$classes[] = 'menu-item-' . $item->ID;
@mbeall
mbeall / the_post_thumbnail_caption.php
Created January 19, 2013 00:41
A function that displays the caption for a featured image.
<?php
function the_post_thumbnail_caption() {
global $post;
$thumbnail_id = get_post_thumbnail_id($post->ID);
$thumbnail_image = get_posts(array('p' => $thumbnail_id, 'post_type' => 'attachment'));
if ($thumbnail_image && isset($thumbnail_image[0])) {
echo '<div class="caption">'.$thumbnail_image[0]->post_excerpt.'</div>';
}
@mbeall
mbeall / Tool_Colors_Widget.php
Created January 19, 2013 00:43
Class that creates widget that displays color options. Originally used in leather theme.
<?php
class Tool_Colors_Widget extends WP_Widget {
function Tool_Colors_Widget() {
$widget_ops = array( 'classname' => 'tool-colors', 'description' => __('A widget that displays the tool color swatches', 'tool-colors') );
$control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'tool-colors-widget' );
$this->WP_Widget( 'tool-colors-widget', __('Tool Colors Widget', 'tool-colors'), $widget_ops, $control_ops );
}
@mbeall
mbeall / navClasses.php
Created March 31, 2013 02:04
This walker changes the "Classes" field in the menu builder to apply classes to the <a> element instead of the <li> element.
//Insert this class in the main plugin file or functions.php
class class_attr_nav extends Walker {
function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
$class_names = $value = '';
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
$classes[] = 'menu-item-' . $item->ID;
@mbeall
mbeall / content-beneficiary.php
Created June 13, 2013 02:35
Templates for sparks_cause for the beneficiary and project types. Use to extend Flint with the plugin Steel activated.
<?php
/**
* @package Sparks
* @sub-package Causes
*/
?>
<?php if ( is_user_logged_in() ) { ?>
<div class="container-fluid">
<div class="row-fluid">
<a class="btn btn-info btn-small" href="<?php echo get_edit_post_link(); ?>" style="color:#fff;float:right;"><i class="icon-edit icon-white"></i> Edit</a>
@mbeall
mbeall / content-product.php
Created June 13, 2013 02:44
Templates for sparks_product. Use to extend Flint in conjunction with the plugin Steel.
<?php
/**
* @package Sparks
* @sub-package Store
*/
?>
<?php if ( is_user_logged_in() ) { ?>
<div class="container-fluid">
<div class="row-fluid">
@mbeall
mbeall / content-event.php
Created August 22, 2013 03:53
Leftover and removed from LifePointe Theme
<?php
/**
* @package WordPress
* @subpackage LifePointe
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<h1 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'lifepointe' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
<?php
/*
Plugin Name: Sparks Food
Plugin URI: http://starverte.com/plugins/sparks-food
Description: Part of the Sparks Framework. A plugin that allows for easy restaurant management.
Version: 0.1.0
Author: Star Verte LLC
Author URI: http://www.starverte.com
License: GPLv2 or later
<?php
/*
Plugin Name: Sparks Causes
Plugin URI: //Not yet developed
Description: Part of the Sparks Framework. A plugin that allows creation and management of causes, creation and management of beneficiaries, featuring online donations, progress tracking, and automatic removal of beneficiaries fully sponsored.
Version: 0.9
Author: Star Verte LLC
Author URI: http://www.starverte.com
License: GPLv2 or later