diff --git a/css/customizer.css b/css/customizer.css new file mode 100644 index 0000000..c178fbc --- /dev/null +++ b/css/customizer.css @@ -0,0 +1,23 @@ +.oblique-upgrade-to-pro-button { + padding: 3px 6px !important; + line-height: 1.5 !important; + font-size: 9px !important; + color: #ffffff !important; + background-color: #EA6F60; + letter-spacing: 1px; + text-transform: uppercase; +} +.customizer-review-link { + padding-top: 10px; + text-align: center; +} + +.customizer-review-link p { + font-size: 12px; + margin-bottom: 0; +} + +.customizer-review-link span { + font-size: 12px; + width: 12px; +} \ No newline at end of file diff --git a/functions.php b/functions.php index b2824fa..86e9725 100644 --- a/functions.php +++ b/functions.php @@ -287,3 +287,11 @@ function oblique_html5shiv() { * Styles */ require get_template_directory() . '/inc/styles.php'; + +/** + * Customizer styles + */ +function oblique_customizer_styles() { + wp_enqueue_style( 'oblique-customizer-styles', get_template_directory_uri() . '/css/customizer.css' ); +} +add_action( 'customize_controls_print_styles', 'oblique_customizer_styles' ); \ No newline at end of file diff --git a/inc/customizer.php b/inc/customizer.php index 34aa42e..e735acf 100644 --- a/inc/customizer.php +++ b/inc/customizer.php @@ -881,9 +881,37 @@ function oblique_registers() { wp_enqueue_script( 'oblique_customizer_script', get_template_directory_uri() . '/js/oblique_customizer.js', array("jquery"), '20120206', true ); wp_localize_script( 'oblique_customizer_script', 'obliqueCustomizerObject', array( - 'github' => __('GitHub','oblique'), - 'review' => __('Leave a Review', 'oblique'), - 'documentation' => __('Documentation', 'oblique') + 'documentation' => __('Documentation', 'oblique'), + 'pro' => __('View PRO version', 'oblique') ) ); } add_action( 'customize_controls_enqueue_scripts', 'oblique_registers' ); + +/* ajax callback for dismissable Asking for reviews */ +add_action( 'wp_ajax_oblique_dismiss_asking_for_reviews','oblique_dismiss_asking_for_reviews_callback' ); +add_action( 'wp_ajax_nopriv_oblique_dismiss_asking_for_reviews','oblique_dismiss_asking_for_reviews_callback' ); +/** + * Dismiss asking for reviews + */ +function oblique_dismiss_asking_for_reviews_callback() { + + if( !empty($_POST['ask']) ) { + set_theme_mod('oblique_ask_for_review',esc_attr($_POST['ask'])); + } + die(); +} +add_action( 'customize_controls_enqueue_scripts', 'oblique_asking_for_reviews_script' ); +function oblique_asking_for_reviews_script() { + + $oblique_review = 'yes'; + + $oblique_ask_for_review = get_theme_mod('oblique_ask_for_review'); + if( !empty($oblique_ask_for_review) ) { + $oblique_review = $oblique_ask_for_review; + } + wp_enqueue_script( 'oblique-asking-for-reviews-js', get_template_directory_uri() . '/js/oblique_reviews.js', array('jquery') ); + wp_localize_script( 'oblique-asking-for-reviews-js', 'obliqueAskingForReviewsObject', array( + 'ask' => $oblique_review, + 'ajaxurl' => admin_url( 'admin-ajax.php' ), + ) ); +} \ No newline at end of file diff --git a/js/oblique_customizer.js b/js/oblique_customizer.js index d4fcac6..e146825 100644 --- a/js/oblique_customizer.js +++ b/js/oblique_customizer.js @@ -13,13 +13,13 @@ jQuery(document).ready(function() { if( jQuery( ".oblique-upsells" ).length ) { - jQuery('.oblique-upsells').append('{documentation}'.replace('{documentation}', obliqueCustomizerObject.documentation)); - jQuery('.oblique-upsells').append('{github}'.replace('{github}', obliqueCustomizerObject.github)); - jQuery('.oblique-upsells').append('{review}'.replace('{review}', obliqueCustomizerObject.review)); + jQuery('.oblique-upsells').append('{documentation}'.replace('{documentation}', obliqueCustomizerObject.documentation)); } if ( !jQuery( ".oblique-upsells" ).length ) { jQuery('#customize-theme-controls > ul').prepend(''); } + + jQuery('.preview-notice').append('{pro}'.replace('{pro}',obliqueCustomizerObject.pro)); }); diff --git a/js/oblique_reviews.js b/js/oblique_reviews.js new file mode 100644 index 0000000..c75496c --- /dev/null +++ b/js/oblique_reviews.js @@ -0,0 +1,41 @@ +jQuery(document).ready(function($) { + + var load_ask_for_reviews = function(){ + $.ajax({ + type : "POST", + data : {action: 'oblique_dismiss_asking_for_reviews'}, + dataType : "html", + url : obliqueAskingForReviewsObject.ajaxurl, + success : function(data){ + if( obliqueAskingForReviewsObject.ask == 'no') { + jQuery('.customizer-review-link').remove(); + } else { + jQuery('#customize-theme-controls').append(''); + } + }, + error : function(jqXHR, textStatus, errorThrown) { + console.log(jqXHR + " :: " + textStatus + " :: " + errorThrown); + } + }); + } + + var dismiss_ask_for_reviews = function(){ + $.ajax({ + type : "POST", + data : {action: 'oblique_dismiss_asking_for_reviews', ask: 'no'}, + dataType : "html", + url : obliqueAskingForReviewsObject.ajaxurl, + success : function(data){ + jQuery('.customizer-review-link').remove(); + }, + error : function(jqXHR, textStatus, errorThrown) { + console.log(jqXHR + " :: " + textStatus + " :: " + errorThrown); + } + }); + } + + $('.customizer-review-link a').die("click").live("click",function() { + dismiss_ask_for_reviews(); + }); + load_ask_for_reviews(); +}); \ No newline at end of file diff --git a/style.css b/style.css index c44db9d..b1afb63 100644 --- a/style.css +++ b/style.css @@ -4,7 +4,7 @@ Theme URI: http://themeisle.com/themes/oblique Author: Themeisle Author URI: http://themeisle.com/ Description: Oblique is a creative masonry theme that works great for fashion or general bloggers. Amongst the features you will find a a parallax header image, full color control with unlimited color variations, easy access to all Google Fonts, responsive design etc. -Version: 1.09 +Version: 1.10 License: GNU General Public License v2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Text Domain: oblique