From f716b06429aed7009561fdb02fb2c61403b1ae64 Mon Sep 17 00:00:00 2001 From: MickeyKay Date: Fri, 21 Nov 2014 16:03:12 -0800 Subject: [PATCH] Cool changes to jquery and shortcodes. --- includes/functions/theme-functions.php | 2 +- includes/js/theme-jquery.js | 4 ++-- includes/shortcodes/shortcodes.php | 20 +++++++++----------- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/includes/functions/theme-functions.php b/includes/functions/theme-functions.php index ad05d30..ea71f76 100644 --- a/includes/functions/theme-functions.php +++ b/includes/functions/theme-functions.php @@ -46,7 +46,7 @@ function trestle_header_actions() { $php_vars = array ( 'trestle_equal_cols_breakpoint' => genesis_get_option( 'trestle_equal_cols_breakpoint' ), ); - wp_localize_script( 'theme-jquery', 'php_vars', $php_vars ); + wp_localize_script( 'theme-jquery', 'trestle_vars', $php_vars ); } diff --git a/includes/js/theme-jquery.js b/includes/js/theme-jquery.js index 4a167fc..57cb300 100644 --- a/includes/js/theme-jquery.js +++ b/includes/js/theme-jquery.js @@ -10,8 +10,8 @@ jQuery(document).ready(function() { // Get PHP vars passed via wp_localize_script() - trestleEqualColsBreakpoint = php_vars.trestle_equal_cols_breakpoint; - trestleEqualHeightCols = php_vars.trestle_equal_height_cols + trestleEqualColsBreakpoint = trestle_vars.trestle_equal_cols_breakpoint; + trestleEqualHeightCols = trestle_vars.trestle_equal_height_cols; // Remove .no-jquery body class jQuery('body').removeClass('no-jquery'); diff --git a/includes/shortcodes/shortcodes.php b/includes/shortcodes/shortcodes.php index 5f6adcb..1c9cb09 100644 --- a/includes/shortcodes/shortcodes.php +++ b/includes/shortcodes/shortcodes.php @@ -62,20 +62,18 @@ function trestle_button( $atts, $content = null ) { add_shortcode( 'button', 'trestle_button' ); /** - * Blockquote + * Buttons * * Example: - * [blockquote name="Speaker" sub_text="Position, Company"]Contents[/blockquote] + * [button href="url" title="title" target="target" class="class"]Text[/button] */ -function trestle_blockquote( $atts, $content = null ) { +function trestle_button( $atts, $content = null ) { extract( shortcode_atts( array( - 'name' => '', - 'sub_text' => '', + 'href' => '#', + 'target' => '', + 'title' => '', + 'class' => '', ), $atts ) ); - - $sub_text_html = $sub_text ? '' . $sub_text . '' : ''; - $cite = $name ? '' . $name . $sub_text_html . '' : ''; - - return '

' . $content . $cite . '

'; + return '' . do_shortcode( $content ) . ''; } -add_shortcode( 'blockquote', 'trestle_blockquote' ); \ No newline at end of file +add_shortcode( 'button', 'trestle_button' );