Created
October 22, 2013 14:31
-
-
Save mjepson/7101736 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function woo_shortcode_post_categories ( $atts ) { | |
$defaults = array( | |
'sep' => ', ', | |
'before' => '', | |
'after' => '', | |
'taxonomy' => 'category' | |
); | |
$atts = shortcode_atts( $defaults, $atts ); | |
$atts = array_map( 'wp_kses_post', $atts ); | |
$terms = get_the_terms( get_the_ID(), esc_html( $atts['taxonomy'] ) ); | |
$cats = ''; | |
if ( is_array( $terms ) && 0 < count( $terms ) ) { | |
$links_array = array(); | |
foreach ( $terms as $k => $v ) { | |
$term_name = get_term_field( 'name', $v->term_id, $atts['taxonomy'] ); | |
$links_array[] = '<a href="' . esc_url( get_term_link( $v, $atts['taxonomy'] ) ) . '" title="' . esc_attr( sprintf( __( 'View all items in %s', 'woothemes' ), $term_name ) ) . '">' . esc_html( $term_name ) . '</a>'; | |
} | |
$cats = join( $atts['sep'], $links_array ); | |
} | |
$output = sprintf('<span class="categories">%2$s%1$s%3$s</span> ', $cats, $atts['before'], $atts['after']); | |
return apply_filters( 'woo_shortcode_post_categories', $output, $atts ); | |
} // End woo_shortcode_post_categories() | |
/*-----------------------------------------------------------------------------------*/ | |
/* Start WooThemes Functions - Please refrain from editing this section */ | |
/*-----------------------------------------------------------------------------------*/ | |
// Set path to WooFramework and theme specific functions | |
$functions_path = get_template_directory() . '/functions/'; | |
$includes_path = get_template_directory() . '/includes/'; | |
// Don't load alt stylesheet from WooFramework | |
if ( ! function_exists( 'woo_output_alt_stylesheet' ) ) { | |
function woo_output_alt_stylesheet () {} | |
} | |
// Define the theme-specific key to be sent to PressTrends. | |
define( 'WOO_PRESSTRENDS_THEMEKEY', 'tnla49pj66y028vef95h2oqhkir0tf3jr' ); | |
// WooFramework | |
require_once ( $functions_path . 'admin-init.php' ); // Framework Init | |
if ( get_option( 'woo_woo_tumblog_switch' ) == 'true' ) { | |
//Enable Tumblog Functionality and theme is upgraded | |
update_option( 'woo_needs_tumblog_upgrade', 'false' ); | |
update_option( 'tumblog_woo_tumblog_upgraded', 'true' ); | |
update_option( 'tumblog_woo_tumblog_upgraded_posts_done', 'true' ); | |
require_once ( $functions_path . 'admin-tumblog-quickpress.php' ); // Tumblog Dashboard Functionality | |
} | |
/*-----------------------------------------------------------------------------------*/ | |
/* Load the theme-specific files, with support for overriding via a child theme. | |
/*-----------------------------------------------------------------------------------*/ | |
$includes = array( | |
'includes/theme-options.php', // Options panel settings and custom settings | |
'includes/theme-functions.php', // Custom theme functions | |
'includes/theme-actions.php', // Theme actions & user defined hooks | |
'includes/theme-comments.php', // Custom comments/pingback loop | |
'includes/theme-js.php', // Load JavaScript via wp_enqueue_script | |
'includes/sidebar-init.php', // Initialize widgetized areas | |
'includes/theme-widgets.php', // Theme widgets | |
'includes/theme-advanced.php', // Advanced Theme Functions | |
'includes/theme-shortcodes.php', // Custom theme shortcodes | |
'includes/woo-layout/woo-layout.php', // Layout Manager | |
'includes/woo-meta/woo-meta.php', // Meta Manager | |
'includes/woo-hooks/woo-hooks.php' // Hook Manager | |
); | |
// Allow child themes/plugins to add widgets to be loaded. | |
$includes = apply_filters( 'woo_includes', $includes ); | |
foreach ( $includes as $i ) { | |
locate_template( $i, true ); | |
} | |
// Load WooCommerce functions, if applicable. | |
if ( is_woocommerce_activated() ) { | |
locate_template( 'includes/theme-woocommerce.php', true ); | |
} | |
/*-----------------------------------------------------------------------------------*/ | |
/* You can add custom functions below */ | |
/*-----------------------------------------------------------------------------------*/ | |
/*-----------------------------------------------------------------------------------*/ | |
/* Don't add any code below here or the sky will fall down */ | |
/*-----------------------------------------------------------------------------------*/ | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment