diff --git a/system/config.ini b/system/config.ini
index c878606..82e0e68 100644
--- a/system/config.ini
+++ b/system/config.ini
@@ -30,6 +30,7 @@ tag.perpage = "10"
archive.perpage = "10"
search.perpage = "10"
profile.perpage = "30"
+related.count = "4"
rss.count = "30"
json.count = "10"
diff --git a/system/includes/functions.php b/system/includes/functions.php
index 1706d70..f3b7749 100644
--- a/system/includes/functions.php
+++ b/system/includes/functions.php
@@ -613,6 +613,39 @@ function get_keyword($keyword){
return $tmp;
}
+// Get related posts
+function get_related($tag) {
+
+ $perpage = config('related.count');
+ $posts = get_tag($tag);
+ $tmp = array();
+ $req = $_SERVER['REQUEST_URI'];
+
+ foreach ($posts as $post) {
+ $url = $post->url;
+ if( strpos($url, $req) === false){
+ $tmp[] = $post;
+ }
+ }
+
+ $total = count($tmp);
+
+ if($total >= 1) {
+
+ shuffle($tmp);
+
+ $i = 1;
+ echo '
';
+ }
+
+}
+
+
// Helper function to determine whether
// to show the previous buttons
function has_prev($prev){
@@ -846,25 +879,11 @@ function menu(){
}
}
-// Menu
-function search() {
- echo <<
-
-
-
-EOF;
- if(isset($_GET['search'])) {
- $url = site_url() . 'search/' . $_GET['search'];
- header ("Location: $url");
- }
-}
-
// Auto generate menu from static page
function get_menu() {
$posts = get_spage_names();
- ksort($posts);
+ krsort($posts);
echo '';
echo '- Home
';
@@ -883,6 +902,21 @@ function get_menu() {
}
+// Search form
+function search() {
+ echo <<
+
+
+
+EOF;
+ if(isset($_GET['search'])) {
+ $url = site_url() . 'search/' . $_GET['search'];
+ header ("Location: $url");
+ }
+}
+
+
// The not found error
function not_found(){
error(404, render('404', null, false));
diff --git a/themes/clean/css/style.css b/themes/clean/css/style.css
index 9c2be43..ff152ed 100644
--- a/themes/clean/css/style.css
+++ b/themes/clean/css/style.css
@@ -366,6 +366,23 @@ aside .copyright p{
margin: 5px 0;
}
+/*-------------------------
+ Raleted posts
+--------------------------*/
+
+.related {
+ font-size: 14px;
+ font-family: 'Open Sans Condensed',sans-serif;
+ width:100%;
+ float:left;
+ margin-bottom: 1em;
+}
+
+.related ul {
+ margin-top:0;
+ margin-bottom: 1em;
+}
+
/*----------------------------
Pagination buttons
-----------------------------*/
diff --git a/themes/clean/post.html.php b/themes/clean/post.html.php
index 7223f09..97982d8 100644
--- a/themes/clean/post.html.php
+++ b/themes/clean/post.html.php
@@ -34,6 +34,7 @@
+ tag)?>
diff --git a/themes/default/css/style.css b/themes/default/css/style.css
index 146a8cb..2bee8ee 100644
--- a/themes/default/css/style.css
+++ b/themes/default/css/style.css
@@ -431,6 +431,27 @@ h1.title-post a:hover, h2.title-index a:hover {
width:100%;
}
+/*-------------------------
+ Raleted posts
+--------------------------*/
+
+.related {
+ font-size: 14px;
+ font-family: 'Open Sans',sans-serif;
+ width:100%;
+ float:left;
+ margin-bottom: 1em;
+}
+
+.related h4 {
+ margin-top: 0;
+}
+
+.related ul {
+ margin-top:0;
+ margin-bottom: 1em;
+}
+
/*-------------------------
Pagination + Postnav
--------------------------*/
@@ -449,7 +470,6 @@ h1.title-post a:hover, h2.title-index a:hover {
border-radius: 3px;
color: #555555;
line-height: 1;
- padding: 10px 20px;
text-align: center;
}
@@ -461,10 +481,39 @@ h1.title-post a:hover, h2.title-index a:hover {
.postnav .newer {
float:left;
margin-right:1em;
+ padding: 10px 15px 10px 25px;
}
.postnav .older {
float:right;
+ padding: 10px 25px 10px 15px;
+}
+
+.postnav .pagination-arrow{
+ display: inline-block;
+ border-radius: 3px;
+ color: #555 !important;
+ text-decoration: none !important;
+ text-transform: none;
+ position: relative;
+}
+
+.postnav .pagination-arrow.newer:before,
+.postnav .pagination-arrow.older:before{
+ content: '';
+ border: 5px solid #555;
+ border-color: transparent #555 transparent transparent;
+ width: 0;
+ height: 0;
+ position: absolute;
+ left: 5px;
+ top: 12px;
+}
+
+.postnav .pagination-arrow.older:before{
+ left:auto;
+ right:5px;
+ border-color: transparent transparent transparent #555;
}
.pager {
diff --git a/themes/default/post.html.php b/themes/default/post.html.php
index 7223f09..97982d8 100644
--- a/themes/default/post.html.php
+++ b/themes/default/post.html.php
@@ -34,6 +34,7 @@
+ tag)?>