[gnome-web-www] display new breadcrumb in #page_title when viewing hierarchical pages



commit 6e10d16af95d633584978d7c2128738a501fc2d4
Author: Vinicius Depizzol <vdepizzol gmail com>
Date:   Tue Jan 31 22:29:54 2012 -0200

    display new breadcrumb in #page_title when viewing hierarchical pages

 theme/functions.php      |   27 +++++++++++++++++++++++++++
 theme/inc/page-title.php |    6 ++++++
 theme/index.php          |    4 +---
 theme/page-members.php   |    4 +---
 theme/style.css          |   18 ++++++++++++++----
 5 files changed, 49 insertions(+), 10 deletions(-)
---
diff --git a/theme/functions.php b/theme/functions.php
index aa84d37..ec65264 100644
--- a/theme/functions.php
+++ b/theme/functions.php
@@ -279,6 +279,33 @@ add_action('save_post', 'save_project_post');
 
 
 
+/*
+ * Add breadcrumb support for hierarchical pages
+ */
+
+function the_breadcrumb() {
+    
+    global $post;
+    $delimiter = '&raquo;';
+
+    if ( is_page() && $post->post_parent ) {
+        $parent_id  = $post->post_parent;
+        $breadcrumbs = array();
+        while ($parent_id) {
+            $page = get_page($parent_id);
+            $breadcrumbs[] = '<a href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a>';
+            $parent_id  = $page->post_parent;
+        }
+        $breadcrumbs = array_reverse($breadcrumbs);
+        foreach ($breadcrumbs as $crumb) {
+            echo $crumb . ' ' . $delimiter . ' ';
+        }
+
+    }
+    
+}
+
+
 
 /*
  * Identify Ajax Language Selector
diff --git a/theme/inc/page-title.php b/theme/inc/page-title.php
new file mode 100644
index 0000000..19579d7
--- /dev/null
+++ b/theme/inc/page-title.php
@@ -0,0 +1,6 @@
+<div class="page_title">
+    <hgroup>
+        <div class="breadcrumb"><?php the_breadcrumb(); ?></div>
+        <h1><?php the_title(); ?></h1>
+    </hgroup>
+</div>
diff --git a/theme/index.php b/theme/index.php
index 97536fb..79bb503 100644
--- a/theme/index.php
+++ b/theme/index.php
@@ -10,9 +10,7 @@ require_once("header.php"); ?>
     <div id="container" class="two_columns">
         <div class="container_12">
         
-            <div class="page_title">
-                <h1><?php the_title(); ?></h1>
-            </div>
+            <?php require_once('inc/page-title.php'); ?>
             
             <div class="content">
             <?php while ( have_posts() ) : the_post(); ?>
diff --git a/theme/page-members.php b/theme/page-members.php
index e27fe1b..d79c7a4 100644
--- a/theme/page-members.php
+++ b/theme/page-members.php
@@ -22,9 +22,7 @@ require_once("header.php"); ?>
     <div id="container" class="two_columns">
         <div class="container_12">
         
-            <div class="page_title">
-                <h1><?php the_title(); ?></h1>
-            </div>
+            <?php require_once('inc/page-title.php'); ?>
             
             <div class="content without_sidebar">
             <?php while ( have_posts() ) : the_post(); ?>
diff --git a/theme/style.css b/theme/style.css
index cd393fc..f7ff737 100644
--- a/theme/style.css
+++ b/theme/style.css
@@ -245,15 +245,25 @@ a:visited {
 
 
 .page_title {
-   margin: 10px 10px 20px;
-   border-bottom: 1px solid #d3d7cf;
+    margin: 10px 10px 20px;
+    border-bottom: 1px solid #d3d7cf;
+}
+.page_title .breadcrumb {
+    color: #888a85;
+}
+.page_title .breadcrumb a {
+    color: inherit;
+    text-decoration: none;
+}
+.page_title .breadcrumb a:hover {
+    text-decoration: underline;
 }
 .page_title h1 {
-    margin: 0;
+    margin: 0 0 6px;
     font-size: 37px;
     text-shadow: 0 1px 0 #fff;
     line-height: normal;
-    letter-spacing: -0.08em;
+    letter-spacing: -0.05em;
 }
 .page_title h1 a {
     text-decoration: none;



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