Skip to content

Commit

Permalink
lots of new styles and functions
Browse files Browse the repository at this point in the history
  • Loading branch information
frebro committed Apr 22, 2012
1 parent 0b389e3 commit c537c72
Show file tree
Hide file tree
Showing 7 changed files with 127 additions and 3 deletions.
3 changes: 3 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
if(@file_exists(dirname(__FILE__) . '/inc/unhyped_featured_event_widget.php')) {
include_once dirname(__FILE__) . '/inc/unhyped_featured_event_widget.php';
}
if(@file_exists(dirname(__FILE__) . '/inc/unhyped_staff_listing_widget.php')) {
include_once dirname(__FILE__) . '/inc/unhyped_staff_listing_widget.php';
}

/**
* Sets up theme defaults and registers support for various WordPress features.
Expand Down
17 changes: 16 additions & 1 deletion inc/unhyped_featured_event_widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function form($instance) {
$event_id = strip_tags($instance['event_id']);
?>
<p><label for="<?php echo $this->get_field_id('event_id'); ?>"><?php _e('Event ID:', 'unhyped'); ?>
<input class="widefat" id="<?php echo $this->get_field_id('event_id'); ?>" name="<?php echo $this->get_field_name('event_id'); ?>" type="text" value="<?php echo attribute_escape($event_id); ?>" /></label></p>
<input class="widefat" id="<?php echo $this->get_field_id('event_id'); ?>" name="<?php echo $this->get_field_name('event_id'); ?>" type="text" value="<?php echo esc_attr($event_id); ?>" /></label></p>
<?php
}

Expand Down Expand Up @@ -77,9 +77,24 @@ function widget($args, $instance) {
<div class="content event">
<?php
$event = get_post($event_id);
$venue = eo_get_venue_name(intval(eo_get_venue($event_id)));

// String representations of date
if ( $event->StartDate == date('Y-m-d') ):
$datestr = __('Today', 'unhyped');
elseif ( $event->StartDate == date('Y-m-d', time()+86400) ):
$datestr = __('Tomorrow', 'unhyped');
else:
$date = new DateTime($event->StartDate);
$datestr = $date->format('M j');
endif;

echo '<a href="'.post_permalink($event_id).'">';
echo '<h2 class="entry-title">'.$event->post_title.'</h2>';
echo get_the_post_thumbnail($event_id, 'medium');
echo '<p class="entry-meta"><span class="date">'.$datestr.'</span>';
if (!empty($venue)) echo 'at <span class="location">'.$venue.'</span>';
echo '</p>';
echo '<p class="entry-excerpt">'.$event->post_excerpt.'</p>';
echo '</a>';
echo '<!--';
Expand Down
87 changes: 87 additions & 0 deletions inc/unhyped_staff_listing_widget.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?php
/**
* @Package Wordpress
* @SubPackage Widgets
*
* Plugin Name: unHYPED Featured Events Widget
* Description: Creates a list of the most recent alarms (requires custom post type 'alarm').
* Author: Fredrik Broman
* Author URI: http://syn-ack.se
*/

defined('ABSPATH') or die("Cannot access pages directly.");

/**
* Initializing
*
* The directory separator is different between linux and microsoft servers.
* Thankfully php sets the DIRECTORY_SEPARATOR constant so that we know what
* to use.
*/
defined("DS") or define("DS", DIRECTORY_SEPARATOR);

/**
* Actions and Filters
*
* Register any and all actions here. Nothing should actually be called
* directly, the entire system will be based on these actions and hooks.
*/
add_action( 'widgets_init', create_function( '', 'register_widget("UNHYPED_Staff_Listing_Widget");' ) );


/**
*
* RVB Stationmap Widget
*/
class UNHYPED_Staff_Listing_Widget extends WP_Widget {
/**
* Constructor
*
* Registers the widget details with the parent class
*/
function UNHYPED_Staff_Listing_Widget() {
// widget actual processes
parent::WP_Widget( $id = 'UNHYPED_Staff_Listing_Widget', $name = __('Staff Listing', 'unhyped'), $options = array( 'description' => __('Displays a list of featured staff members', 'unhyped') ) );
}

function form($instance) {
$instance = wp_parse_args( (array) $instance, array( 'user_id_csv' => '' ) );
$user_id_csv = strip_tags($instance['user_id_csv']);
?>
<p><label for="<?php echo $this->get_field_id('user_id_csv'); ?>"><?php _e('User IDs (comma separated):', 'unhyped'); ?>
<input class="widefat" id="<?php echo $this->get_field_id('user_id_csv'); ?>" name="<?php echo $this->get_field_name('user_id_csv'); ?>" type="text" value="<?php echo esc_attr($user_id_csv); ?>" /></label></p>
<?php
}

function update($new_instance, $old_instance) {
$instance = $old_instance;
$instance['user_id_csv'] = strip_tags($new_instance['user_id_csv']);
return $instance;
}

function widget($args, $instance) {
// outputs the content of the widget
extract( $args );

if (empty($instance['user_id_csv']))
return;

$user_id_csv = apply_filters('widget_post_id', $instance['user_id_csv']);

echo $before_widget;

if ( ! empty( $title ) )
echo $before_title . $title . $after_title;
?>

<div class="content">
<?php
echo $user_id_csv;
?>
</div>

<?php
echo $after_widget;
}
}
?>
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
* @subpackage UNHYPED
*/

require_once get_template_directory() . '/index.php';
require_once get_template_directory() . '/index.php';
?>
4 changes: 4 additions & 0 deletions sass/modules/_components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@
color: $bg-color;
padding: .25 * $base-vmargin .5 * $base-hmargin;
}
.entry-meta,
.entry-excerpt {
font-size: $small-font-size;
}
.entry-meta {
color: $mute-color;
}
}
&:before,
&:after {
Expand Down
15 changes: 15 additions & 0 deletions sass/partials/_page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@ a {
text-decoration: none;
}

blockquote {
font-style: italic;
text-indent: -.4em;
*:first-child {
&:before {
content: '';
}
}
*:last-child {
&:after {
content: '';
}
}
}

#container {
@include box-sizing( border-box );
@include clearfix;
Expand Down
Loading

0 comments on commit c537c72

Please sign in to comment.