diff --git a/system/config.ini b/system/config.ini index cbc2639..c878606 100644 --- a/system/config.ini +++ b/system/config.ini @@ -12,7 +12,7 @@ social.facebook = "https://www.facebook.com" social.google = "https://plus.google.com" social.tumblr = "http://www.tumblr.com" -; Menu link +; Custom menu link blog.menu = "" ; Disqus diff --git a/system/includes/functions.php b/system/includes/functions.php index fed81f7..5582f64 100644 --- a/system/includes/functions.php +++ b/system/includes/functions.php @@ -396,15 +396,12 @@ function get_spage($posts, $spage){ if( strpos($v, "$spage") !== false && strpos($v, $spage.'.md') !== false){ $post = new stdClass; - - // Extract the array - $arr = explode('_', $v); // Replaced string - $replaced = substr($arr[0], 0,strrpos($arr[0], '/')) . '/'; + $replaced = substr($v, 0, strrpos($v, '/')) . '/'; // The static page URL - $url = str_replace($replaced,'',$arr[0]); + $url = str_replace($replaced,'',$v); $post->url = site_url() . str_replace('.md','',$url); // Get the contents and convert it to HTML @@ -847,6 +844,32 @@ function menu(){ if (!empty($menu)) { return $menu; } + else { + get_menu(); + } +} + +// Auto generated menu from static page +function get_menu() { + + $posts = get_spage_names(); + ksort($posts); + + echo ''; + } // The not found error