template/wordpress/code/main.php in edge_framework-1.3.1 vs template/wordpress/code/main.php in edge_framework-1.3.2
- old
+ new
@@ -1,43 +1,35 @@
<?php
-/* -------------------------------------------
- EDGE Press v1.0
- - Cleaner code for Wordpress Theme
- - Requirement: Wordpress 3.8 and PHP 5.3
-------------------------------------------- */
include "inflector.php";
include "cpt.php";
-include "query.php";
-function home() { echo home_url()."/"; }
-function root() { return get_template_directory_uri()."/"; }
- function img() { echo root()."assets/img/"; }
- function css() { echo root()."assets/css/"; }
- function js() { echo root()."assets/js/"; }
- function files() { echo root()."assets/files/"; }
+class TimberEdge extends TimberSite {
+ function __construct(){
+ add_filter("timber_context", array($this, "add_to_context") );
+ add_filter("get_twig", array($this, "add_to_twig") );
+ parent::__construct();
+ }
-/*
- CUSTOM NAV MENU
-*/
+ function add_to_context($context) {
+ $context["menu"] = new TimberMenu();
+ $context["site"] = $this;
-function edge_nav_menu() {
- wp_nav_menu(array(
- "container" => "nav",
- "container_class" => " ",
- "container_id" => "",
- "menu_class" => " ",
- "menu_id" => " ",
- ));
+ $context["home"] = home_url()."/";
+ $context["root"] = get_template_directory_uri();
+ $context["img"] = $context["root"]."/assets/img";
+ $context["css"] = $context["root"]."/assets/css";
+ $context["js"] = $context["root"]."/assets/js";
+ $context["files"] = $context["root"]."/assets/files";
+
+ return $context;
+ }
+
+ function add_to_twig($twig) {
+ return $twig;
+ }
}
-/* REMOVE MENU ITEMS */
-add_action("admin_menu", "remove_menu_items");
+new TimberEdge();
-
-/* AUTO ADD HEADER and FOOTER */
-add_filter("template_include", function($template) {
- get_header();
- include $template;
- get_footer();
- return FALSE;
-});
+/* REMOVE MENU ITEMS */
+add_action("admin_menu", "remove_menu_items");
\ No newline at end of file