Skip to content

Commit

Permalink
SNOW-1: Refactored functions.php, made styling changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Eloisa committed Dec 8, 2017
1 parent ceacbf6 commit 13af809
Show file tree
Hide file tree
Showing 5 changed files with 184 additions and 63 deletions.
32 changes: 18 additions & 14 deletions footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,24 @@

</div>

<footer class="small-12 columns a11y-site-footer text-center" role="contentinfo">
<p>
License Information
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution 4.0 International license
Terms of Use
</p>
<p>
Contact information
205 Richmond St. W., 2nd fl, Toronto, ON, M5V 1V3 Telephone: 416 977 6000 ext. 3967 Fax: 416 977 9844 idi@ocadu.ca
</p>
<p>
Partners
SNOW is a project of the Inclusive Design Research Centre, OCAD University, funded by Provincial Schools Branch, Ontario Ministry of Education.
</p>
<footer class="row a11y-site-footer" role="contentinfo">
<?php
if (is_active_sidebar('license-info')) {
dynamic_sidebar('license-info');
}
?>

<?php
if (is_active_sidebar('contact')) {
dynamic_sidebar('contact');
}
?>

<?php
if (is_active_sidebar('partners')) {
dynamic_sidebar('partners');
}
?>
</footer>
</div>

Expand Down
2 changes: 2 additions & 0 deletions front-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
}
?>
</section>
<section class="row a11y-panel-container">
</section>

</main>

Expand Down
115 changes: 85 additions & 30 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ function snow_theme_enqueue_styles() {
'id' => 'snow-home',
'before_widget' => '<div id="snow-home" class="snow-home">',
'after_widget' => '</div>',
'before_title' => '<h3 class="snow-title">',
'after_title' => '</h3>'
'before_title' => '<h1 class="snow-title">',
'after_title' => '</h1>'
));

/* Add 'Accessing the Site' to front page */
Expand All @@ -26,8 +26,8 @@ function snow_theme_enqueue_styles() {
'id' => 'access-site',
'before_widget' => '<div id="snow-access" class="snow-access">',
'after_widget' => '</div>',
'before_title' => '<h3 class="snow-access-title">',
'after_title' => '</h3>'
'before_title' => '<h1 class="snow-access-title">',
'after_title' => '</h1>'
));

/* Add 'Share your experiences on SNOW' to front page.' */
Expand All @@ -36,98 +36,153 @@ function snow_theme_enqueue_styles() {
'id' => 'snow-experiences',
'before_widget' => '<div id="snow-experiences" class="snow-experiences">',
'after_widget' => '</div>',
'before_title' => '<h3 class="snow-experiences-title">',
'after_title' => '</h3>'
'before_title' => '<h1 class="snow-experiences-title">',
'after_title' => '</h1>'
));

/* Add footer widgets */
register_sidebar( array(
'name' => __( 'License Information', 'license-info' ),
'id' => 'license-info',
'before_widget' => '<div id="snow-license" class="snow-license">',
'before_widget' => '<div id="snow-license" class="small-12 medium-4 snow-license">',
'after_widget' => '</div>',
'before_title' => '<h3 class="snow-license-title">',
'after_title' => '</h3>'
'before_title' => '<h1 class="snow-license-title">',
'after_title' => '</h1>'
));

register_sidebar( array(
'name' => __( 'Contact Information', 'contact' ),
'id' => 'contact',
'before_widget' => '<div id="snow-contact" class="snow-contact">',
'before_widget' => '<div id="snow-contact" class="small-12 medium-4 snow-contact">',
'after_widget' => '</div>',
'before_title' => '<h3 class="snow-contact-title">',
'after_title' => '</h3>'
'before_title' => '<h1 class="snow-contact-title">',
'after_title' => '</h1>'
));

register_sidebar( array(
'name' => __( 'Partners', 'partners' ),
'id' => 'partners',
'before_widget' => '<div id="snow-partners" class="snow-partners">',
'before_widget' => '<div id="snow-partners" class="small-12 medium-4 snow-partners">',
'after_widget' => '</div>',
'before_title' => '<h3 class="snow-partners-title">',
'after_title' => '</h3>'
'before_title' => '<h1 class="snow-partners-title">',
'after_title' => '</h1>'
));
/* End footer widgets */


/* Begin extending widget for Upcoming Workshops front panel */
function snow_upcoming_workshops_sticky() {
function snow_front_panel_sticky($params = array()) {

/* Get all sticky posts */
$sticky = array(
'category__and' => array( '7' ),
/* Default Parameters */
extract(shortcode_atts(array(
'category__and' => 7, // Change to prod category ID
'posts_per_page' => 1,
'post__in' => get_option( 'sticky_posts' ),
'ignore_sticky_posts' => 1
);
), $params));

/* Query sticky posts */
$the_query = new WP_Query($sticky);
/* Query the posts */
$the_query = new WP_Query($params);
if ( $the_query->have_posts() ) {
while ( $the_query->have_posts() ) {
$the_query->the_post();
$return .= '<p><a href="' .get_permalink(). '" title="' . get_the_title() . '">' . get_the_title() . '</a></p>' . '<p>' . get_the_excerpt() . '</p>';
}

} else {
// no posts found
// No posts found
}

/* Restore original Post Data */
wp_reset_postdata();

return $return;
}
add_shortcode('snow_upcoming_workshops_sticky', 'snow_upcoming_workshops_sticky');
add_shortcode('snow_front_panel_sticky', 'snow_front_panel_sticky');


class snow_upcoming_workshops extends WP_Widget {

/* Set up the widget name and description */
public function __construct() {
$widget_options = array( 'classname' => 'snow_upcoming_workshops', 'description' => 'Display the sticky Upcoming Workshop.' );
parent::__construct( 'snow_upcoming_workshops', 'Upcoming Workshops', $widget_options );
}
public function __construct( $id = 'snow_upcoming_workshops', $descr = 'Upcoming Workshops', $opts = array() ) {
$widget_options = array();
parent::__construct( $id, $descr, $widget_options );
}

/* Create the widget output */
public function widget( $args ) {
$title = 'Upcoming Workshops';
$content = do_shortcode('[snow_upcoming_workshops_sticky]');
$content = do_shortcode('[snow_front_panel_sticky category__and=\'7\']');

echo $args['before_widget'] . $args['before_title'] . $title . $args['after_title']; ?>
<div class="snow-widget">
<?php echo $content; ?>
</div>
<?php echo $args['after_widget'];
}

}

/* Register the widget */
function snow_upcoming_workshops() {
register_widget( 'snow_upcoming_workshops' );
}
add_action( 'widgets_init', 'snow_upcoming_workshops' );
add_action('widgets_init', 'snow_upcoming_workshops');

/* End extending widget for Upcoming Workshops front panel */

class snow_feature_article extends snow_upcoming_workshops {
function __construct() {
$widget_options = array();
parent::__construct( 'snow_feature_article', 'Feature Article', $widget_options );
}

/* Create the widget output */
public function widget( $args ) {
$title = 'Feature Article';
$content = do_shortcode('[snow_front_panel_sticky category__and=\'9\']'); // Change to prod category ID

echo $args['before_widget'] . $args['before_title'] . $title . $args['after_title']; ?>
<div class="snow-widget">
<?php echo $content; ?>
</div>
<?php echo $args['after_widget'];
}
}

/* Register the widget */
function snow_feature_article() {
register_widget( 'snow_feature_article' );
}
add_action('widgets_init', 'snow_feature_article');


class snow_featured_content extends snow_upcoming_workshops {
function __construct() {
$widget_options = array();
parent::__construct( 'snow_featured_content', 'Featured Content', $widget_options );
}

/* Create the widget output */
public function widget( $args ) {
$title = 'Featured Content';
$content = do_shortcode('[snow_front_panel_sticky category__and=\'10\']'); // Change to prod category ID

echo $args['before_widget'] . $args['before_title'] . $title . $args['after_title']; ?>
<div class="snow-widget">
<?php echo $content; ?>
</div>
<?php echo $args['after_widget'];
}
}

/* Register the widget */
function snow_featured_content() {
register_widget( 'snow_featured_content' );
}
add_action('widgets_init', 'snow_featured_content');

/* Enable shortcodes */
add_filter('widget_text', 'do_shortcode');

?>
Expand Down
44 changes: 35 additions & 9 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ html {
padding: 0;
}
.dropdown {
border: 2px solid;
border: 0.01rem solid;
height: 5.5rem;
padding: 0;
}
Expand Down Expand Up @@ -215,8 +215,6 @@ html {
}
.snow-intro {
display: flex;
box-shadow: 0rem 2rem 3rem 0rem #808080;
z-index: 1;
padding: 2rem;
}
.snow-home {
Expand All @@ -240,21 +238,35 @@ html {
text-align: center;
border-bottom: 1px solid #dcde70;
padding-bottom: 0.5rem;
font-size: 1.2rem !important;
}
.snow-experiences {
text-align: center;
background-color: #dcde70;
padding: 1rem 1rem;
margin: 0;
box-shadow: 0.2rem 0.2rem 0.8rem #808080;
/*box-shadow: 0px 5px 12px 0px #808080;*/
}
h3.snow-experiences-title {
h1.snow-experiences-title {
text-transform: uppercase;
text-align: center;
color: #0f191d;
font-size: 1.3rem !important;
}
h3.snow-title {
h1.snow-title {
color: #0f191d;
font-weight: bold;
font-size: 1.5rem !important;
}
.snow-license {
float: left;
}
.snow-contact {
float: left;
}
.snow-partners {
float: right;
}
.column,
.columns {
Expand Down Expand Up @@ -305,6 +317,7 @@ h3.snow-title {
.a11y-panel-container {
padding: 2rem 2rem;
background-color: #f7ac82;
box-shadow: 0.2rem 0.2rem 0.8rem #808080;
}
.a11y-panel-container.row {
margin-left: 0;
Expand All @@ -329,15 +342,18 @@ h3.snow-title {
}
.a11y-front-panel h1,
.a11y-front-panel section,
.a11y-front-panel .textwidget {
.a11y-front-panel .snow-widget {
padding: 0.5rem 1.5rem;
}
.a11y-front-panel .snow-widget a {
color: #0f191d;
text-decoration: underline;
}
/* Site Sidebar (appears on all other pages, except front page) */
.a11y-site-aside {
color: #dcde70;
background: #dcde70;
padding: 1rem 1.6rem;
box-shadow: 0.2rem 0.2rem 0.8rem #808080;
z-index: 1;
}
.a11y-site-aside ul {
Expand Down Expand Up @@ -406,21 +422,31 @@ h3.snow-title {
}
/* Footer */
.a11y-site-footer {
padding: 1rem;
display: flex;
padding: 2rem 2rem;
background-color: #7ec9bc;
color: #0f191d;
font-size: 0.9rem;
}
.a11y-site-footer.row {
margin-left: 0;
margin-right: 0;
}
.a11y-site-footer a {
color: #0f191d;
}
.a11y-site-footer a:hover {
background-color: #0f191d;
color: #00303c;
color: #fff;
}
.a11y-site-footer a:focus {
outline: 0.2rem solid #0f191d;
color: #0f191d;
}
.a11y-site-footer h1 {
font-size: 0.9rem !important;
color: #0f191d;
}
/* Footer styles for the home page only. */
.home .a11y-site-footer {
background-color: #7ec9bc;
Expand Down
Loading

0 comments on commit 13af809

Please sign in to comment.