[gnome-web-www: 29/68] Add a static Foundation page



commit ae299bfe3086f23d7e7c14949ed4912e94f31220
Author: Tom Tryfonidis <tomtryf gnome org>
Date:   Mon Jan 9 17:29:27 2017 +0200

    Add a static Foundation page

 theme/functions.php                                |   48 ++++++++++
 .../images/foundation/foundation_back_balloons.png |  Bin 0 -> 3027 bytes
 theme/images/foundation/foundation_balloon.png     |  Bin 0 -> 7877 bytes
 theme/page-foundation.php                          |   93 ++++++++++++++++++++
 4 files changed, 141 insertions(+), 0 deletions(-)
---
diff --git a/theme/functions.php b/theme/functions.php
index 939b9ed..aab752a 100644
--- a/theme/functions.php
+++ b/theme/functions.php
@@ -154,6 +154,33 @@ add_action( 'init', function() {
         )
     );
 
+    register_post_type( 'directors',
+        array(
+            'labels' => array(
+                'name' => 'Board Directors',
+                'singular_name' => 'Board Director',
+                'add_new' => 'Add New',
+                'add_new_item' => 'Add New Director',
+                'edit' => 'Edit',
+                'edit_item' => 'Edit',
+                'new_item' => 'New Director',
+                'view' => 'View',
+                'view_item' => 'View Director',
+                'search_items' => 'Search Directors',
+                'not_found' => 'No Directors found',
+                'not_found_in_trash' => 'No Directors found in Trash',
+                'parent' => 'Parent Directors',
+            ),
+            'public' => false,
+            'show_ui' => true,
+            'exclude_from_search' => true,
+            'supports' => array(
+                'title', 'thumbnail','revisions', 'author'
+            ),
+            'rewrite' => true
+        )
+    );
+
     register_post_type( 'banners',
         array(
             'labels' => array(
@@ -557,3 +584,24 @@ register_nav_menus( array(
 
 require get_template_directory() . '/inc/customizer.php';
 require get_template_directory() . '/inc/grass-sanitize.php';
+
+/**
+ * Order posts by the last word in the post_title.
+ * Activated when orderby is 'wpse_last_word'
+ * @link http://wordpress.stackexchange.com/a/198624/26350
+ * 
+ * Used in Foundation page to sort the Directors
+ */
+
+add_filter( 'posts_orderby', function( $orderby, \WP_Query $q )
+{
+    if( 'wpse_last_word' === $q->get( 'orderby' ) && $get_order =  $q->get( 'order' ) )
+    {
+        if( in_array( strtoupper( $get_order ), ['ASC', 'DESC'] ) )
+        {
+            global $wpdb;
+            $orderby = " SUBSTRING_INDEX( {$wpdb->posts}.post_title, ' ', -1 ) " . $get_order;
+        }
+    }
+    return $orderby;
+}, PHP_INT_MAX, 2 );
diff --git a/theme/images/foundation/foundation_back_balloons.png 
b/theme/images/foundation/foundation_back_balloons.png
new file mode 100644
index 0000000..4764848
Binary files /dev/null and b/theme/images/foundation/foundation_back_balloons.png differ
diff --git a/theme/images/foundation/foundation_balloon.png b/theme/images/foundation/foundation_balloon.png
new file mode 100644
index 0000000..48e244e
Binary files /dev/null and b/theme/images/foundation/foundation_balloon.png differ
diff --git a/theme/page-foundation.php b/theme/page-foundation.php
new file mode 100644
index 0000000..7d18415
--- /dev/null
+++ b/theme/page-foundation.php
@@ -0,0 +1,93 @@
+<?php get_header(); ?>
+
+        <!-- container -->
+        <div class="container">
+            <div id="foundation" class="content">
+                <div class="col-md-12">            
+                    <div class="page_title">
+                        <h1><?php the_title(); ?></h1>
+                    </div>
+                </div>
+
+                <div class="row">
+                    <div class="col-md-12">
+                        <div class="col-md-7">
+                            <p class="main_feature"><?php esc_html_e('The GNOME Foundation is a non-profit 
organization that furthers the goals of the GNOME Project, helping it to create a free software computing 
platform for the general public that is designed to be elegant, efficient, and easy to use.', 'grass'); ?></p>
+                        </div>
+                        <div class="col-md-4">
+                            <img class="hidden-xs hidden-sm" style="position: absolute; margin-top: -25px; 
margin-left: 140px;" src="<?php bloginfo('stylesheet_directory'); 
?>/images/foundation/foundation_balloon.png" alt="GNOME Balloon"/>
+                        </div>
+                    </div>
+                </div>
+
+                <hr class="bottom_shadow" />
+
+                <div class="row">
+                    <div class="col-md-12">
+                        <div class="col-md-4">
+                            <img class="hidden-xs hidden-sm" style="margin-top: 160px;" src="<?php 
bloginfo('stylesheet_directory'); ?>/images/foundation/foundation_back_balloons.png" alt="GNOME Balloons"/>
+                        </div>
+                        <div class="col-md-8">
+                            <h2><?php esc_html_e('How it works', 'grass'); ?></h2>
+                            <p><?php esc_html_e('While the many GNOME contributors develop code, smash bugs, 
write documentation, and help users, the Foundation acts as a guiding hand in the process and provides 
resources and infrastructure. It steers releases, determines what software is officially part of the Project, 
and acts as the official face of the GNOME Project to the outside world, though it delegates most of its 
authority to specialized teams.', 'grass'); ?></p>
+                            <p>But that face, like the face of GNOME itself, is made by you. The <a 
href="/foundation/membership/">GNOME Foundation membership</a> is open to all GNOME contributors, and every 
member of the Board of Directors is a contributing member of the GNOME community. Becoming a member of the 
Foundation strengthens your voice in the Project and gives you an opportunity to vote on goals that will 
steer the GNOME Project into the future.</p>
+                        </div>
+                    </div>
+                </div>
+
+                <hr class="top_shadow" />
+
+                <div class="row foundation_advisory_board text-center">
+                    <h2><?php esc_html_e('Supporting organizations', 'grass'); ?></h2>
+                    <div class=" col-sm-12">
+                        <?php while ( have_posts() ) : the_post(); ?>
+                            <?php the_content(); ?>
+                        <?php endwhile; // End the loop. Whew. ?>
+                        <p><a href="https://wiki.gnome.org/AdvisoryBoard";><?php esc_html_e('You can find 
more information about our Advisory Board on the wiki.', 'grass'); ?></a></p>
+                    </div>
+                </div>
+
+                <hr class="bottom_shadow" />
+
+                <div class="row board-of-directors">
+                    <div class="col-sm-12">
+                        <div class="col-sm-5">
+                            <h2><?php esc_html_e('Board of Directors', 'grass'); ?></h2>
+                            <p>The GNOME Foundation is run by a <a href="governance">Board of Directors</a>, 
which is elected annually by the GNOME community, as the GNOME Membership, to carry out much of the GNOME 
Foundation’s tasks.</p>
+                            <p>The meetings of the Board of Directors are posted publicly on the <a 
href="https://mail.gnome.org/archives/foundation-list/";>foundation-list mailing list</a> and on the <a 
href="https://wiki.gnome.org/FoundationBoard/Minutes";>Minutes wiki</a> page for easier access.</p>
+                        </div>
+
+                        <div class="col-sm-7">
+                            <div class="foundation_board">
+                                <?php
+                                    $original_query = clone $wp_query;
+                                    // Show Board Directors sorted by their last name
+                                    query_posts(array('post_type' => 'directors', 'posts_per_page' => 7, 
'orderby'=> 'wpse_last_word', 'order' => 'ASC'));
+                                ?>
+
+                                <?php while ( have_posts() ) : the_post(); ?>
+                                    <div class="media">
+                                        <div class="media-left">
+                                            <?php
+                                                if (has_post_thumbnail()) {
+                                                    echo the_post_thumbnail('fog-hacker-icon', array( 
'class' => 'media-object pull-left' ));
+                                                } else {
+                                                    echo '<img 
src="'.get_bloginfo('template_url').'/images/photo-missing.png" class="" alt="" />';
+                                                }
+                                            ?>
+                                        </div>
+                                        <div class="media-body media-middle">
+                                            <?php the_title(); ?>
+                                        </div>
+                                    </div>
+                                <?php endwhile; // End the loop. Whew. ?>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div> <!-- END content -->
+        </div> <!-- END container -->
+ 
+    <div class="clearfix"></div>
+    
+<?php get_footer(); ?>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]