[gnomeweb-wp] added initial support for projects



commit 4637b6432ec8d0894c2da1f8c3fe84a32dce0157
Author: Vinicius Depizzol <vdepizzol gmail com>
Date:   Thu Oct 21 23:58:07 2010 -0200

    added initial support for projects

 wp-content/themes/gnome-grass/functions.php |   53 ++++++++++++++++++++++++---
 wp-content/themes/gnome-grass/project.php   |   42 +++++++++++++++++++++
 wp-content/themes/gnome-grass/single.php    |    9 +++--
 3 files changed, 95 insertions(+), 9 deletions(-)
---
diff --git a/wp-content/themes/gnome-grass/functions.php b/wp-content/themes/gnome-grass/functions.php
index 7431320..27da0ac 100644
--- a/wp-content/themes/gnome-grass/functions.php
+++ b/wp-content/themes/gnome-grass/functions.php
@@ -8,8 +8,15 @@ add_editor_style("editor_style.css");
 
 add_theme_support('menus');
 
-add_theme_support( 'post-thumbnails', array( 'banner' ) );
-set_post_thumbnail_size(940, 350);
+add_theme_support( 'post-thumbnails');
+
+set_post_thumbnail_size(940, 350); // banners for home page
+
+add_image_size( 'icon-big', 256, 256, true);
+add_image_size( 'icon-small', 96, 96, true);
+
+
+// Custom Posts
 
 add_action( 'init', 'create_post_type' );
 function create_post_type() {
@@ -17,10 +24,6 @@ function create_post_type() {
     array(
       'labels' => array(
         'name' => __( 'Banners' ),
-        'singular_name' => __( 'Banner' )
-      ),
-      'labels' => array(
-        'name' => __( 'Banners' ),
         'singular_name' => __( 'Banner' ),
         'add_new' => __( 'Add New' ),
         'add_new_item' => __( 'Add New Banner' ),
@@ -41,10 +44,48 @@ function create_post_type() {
       )
     )
   );
+  
+  register_post_type( 'projects',
+    array(
+      'labels' => array(
+        'name' => __( 'Projects' ),
+        'singular_name' => __( 'Project' ),
+        'add_new' => __( 'Add New' ),
+        'add_new_item' => __( 'Add New Project' ),
+        'edit' => __( 'Edit' ),
+        'edit_item' => __( 'Edit' ),
+        'new_item' => __( 'New Project' ),
+        'view' => __( 'View' ),
+        'view_item' => __( 'View Project' ),
+        'search_items' => __( 'Search Projects' ),
+        'not_found' => __( 'No projects found' ),
+        'not_found_in_trash' => __( 'No projects found in Trash' ),
+        'parent' => __( 'Parent Project' ),
+      ),
+      'public' => true,
+      'exclude_from_search' => false,
+      'supports' => array(
+        'title', 'editor', 'thumbnail', 'excerpt', 'revisions', 'author', 'custom-fields'
+      )
+    )
+  );
 }
 
+
+// WPML specific constants do ignore custom css
+
 define('ICL_DONT_LOAD_NAVIGATION_CSS', true);
 define('ICL_DONT_LOAD_LANGUAGE_SELECTOR_CSS', true);
 
 
+// Beautify [galery] shortcode
+
+add_filter('gallery_style', create_function('$a', 'return preg_replace("%
+<style type=\'text/css\'>(.*?)</style>
+
+%s", "", $a);'));
+
+
+
+
 ?>
diff --git a/wp-content/themes/gnome-grass/project.php b/wp-content/themes/gnome-grass/project.php
new file mode 100644
index 0000000..2104084
--- /dev/null
+++ b/wp-content/themes/gnome-grass/project.php
@@ -0,0 +1,42 @@
+<?php
+/**
+ * @package GNOME Website
+ * @subpackage Grass Theme
+ */
+
+require_once("header.php"); ?>
+
+    <!-- container -->
+    <div id="container">
+        <div class="container_12">
+        
+            <div class="project_title">
+                <style> h1 img { vertical-align: middle } </style>
+                <h1>
+                <?php
+                if ( has_post_thumbnail($post->ID) ) {
+	                echo get_the_post_thumbnail($post->ID, 'icon-small' );
+                } else {
+	                // the current post lacks a thumbnail
+	                echo 'noicon';
+                }
+                ?>
+                <?php the_title(); ?></h1>
+            </div>
+            
+            <div class="content">
+            <?php while ( have_posts() ) : the_post(); ?>
+                <?php the_content(); ?>
+            <?php endwhile; // End the loop. Whew. ?>
+                <br />
+                <div class="clear"></div>
+            </div>
+            <?php require_once("footer_art.php"); ?>
+        </div>
+    </div>
+    
+    <div class="clearfix"></div>
+    
+    <?php require_once("footer.php"); ?>
+</body>
+</html>
diff --git a/wp-content/themes/gnome-grass/single.php b/wp-content/themes/gnome-grass/single.php
index deb95d7..ba061b2 100644
--- a/wp-content/themes/gnome-grass/single.php
+++ b/wp-content/themes/gnome-grass/single.php
@@ -10,11 +10,14 @@ $post_type = get_post_type();
 if($post_type == 'post') {
 
     require_once('news.php');
+
+} elseif($post_type == 'projects') {
+    
+    require_once('project.php');
     
-} elseif($post_type == 'banner') {
+} else {
 
-    //require_once('banner.php');
-    echo 'FIXME';
+    echo 'FIXME '.$post_type;
     
 }
 



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