function image_sizes() { // Allow post thumbnails if current theme doesn't have it already if (!current_theme_supports('post-thumbnails')) { add_theme_support('post-thumbnails'); } add_image_size('sunshine-thumbnail', $this->options['thumbnail_width'], $this->options['thumbnail_height'], $this->options['thumbnail_crop']); if (is_sunshine()) { set_post_thumbnail_size($this->options['thumbnail_width'], $this->options['thumbnail_height'], $this->options['thumbnail_crop']); } }
function sunshine_2013_login() { global $sunshine; if (is_sunshine()) { $css = ''; if (!empty($sunshine->options['2013_sidebar_background_color'])) { $css .= ' body { background-color: ' . $sunshine->options['2013_sidebar_background_color'] . ' !important; }'; } else { $css .= ' body { background-color: #21282e !important; }'; } if (!empty($sunshine->options['2013_menu_link_color'])) { $css .= ' .login #nav a, .login #backtoblog a, .login #nav a:hover, .login #backtoblog a:hover { color: ' . $sunshine->options['2013_menu_link_color'] . ' !important; text-shadow: none !important; }'; } else { $css .= ' .login #nav a, .login #backtoblog a, .login #nav a:hover, .login #backtoblog a:hover { color: #86888a !important; text-shadow: none !important; }'; } echo '<!-- CUSTOM CSS FOR SUNSHINE -->'; echo '<style type="text/css">'; echo $css; echo '</style>'; } }
/** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget($args, $instance) { global $sunshine; if ($instance['visibility'] == 'sunshine_only' && !is_sunshine()) { return; } extract($args); $title = apply_filters('widget_title', $instance['title']); echo $before_widget; if (!empty($title)) { echo $before_title . $title . $after_title; } sunshine_search(); echo $after_widget; }
function sunshine_favorites_add_to_favorites_js() { global $sunshine; if (is_sunshine() && !$sunshine->options['disable_favorites']) { ?> <script> function sunshine_add_image_to_favorites(e) { var image_id = jQuery(e).data('image-id'); var this_link = jQuery(e); jQuery.ajax({ type: 'POST', url: '<?php echo admin_url('admin-ajax.php'); ?> ', data: { action: 'sunshine_add_to_favorites', image_id: image_id }, success: function(data, textStatus, XMLHttpRequest) { data = data.trim(); if (data == 'ADD') { jQuery('#sunshine-image-'+image_id).addClass('sunshine-favorite'); jQuery(e).addClass('sunshine-favorite'); jQuery('span', e).html('<?php _e('Remove from favorites', 'sunshine'); ?> '); if (!jQuery('.sunshine-main-menu .sunshine-favorites .sunshine-favorite-count').length) jQuery('.sunshine-main-menu .sunshine-favorites').append('<span class="sunshine-count sunshine-favorite-count">0</span>'); jQuery('.sunshine-main-menu .sunshine-favorite-count').html(parseInt(jQuery('.sunshine-main-menu .sunshine-favorite-count').html())+1); } else if (data == 'DELETE') { jQuery('#sunshine-image-'+image_id).removeClass('sunshine-favorite'); jQuery(e).removeClass('sunshine-favorite'); jQuery('span', e).html('<?php _e('Add to favorites', 'sunshine'); ?> '); jQuery('.sunshine-main-menu .sunshine-favorite-count').html(parseInt(jQuery('.sunshine-main-menu .sunshine-favorite-count').html())-1); if (parseInt(jQuery('.sunshine-main-menu .sunshine-favorite-count').html()) == 0) jQuery('.sunshine-main-menu .sunshine-favorite-count').remove(); <?php if (is_page($sunshine->options['page_favorites'])) { ?> jQuery('#sunshine-image-'+image_id).fadeOut(); <?php } ?> } }, error: function(MLHttpRequest, textStatus, errorThrown) { alert('<?php _e('Sorry, there was an error with your request'); ?> '+errorThrown+MLHttpRequest+textStatus); } }); return false; } jQuery(document).ready(function() { // Adding items to favorite jQuery('a.add-to-favorites[data-image-id]').click(function() { sunshine_add_image_to_favorites(this); return false; }); }); </script> <?php } }
function donotcachepage() { if (is_sunshine() && !defined('DONOTCACHEPAGE')) { define('DONOTCACHEPAGE', true); } }