Sha256: 00aa623b792aab7589013862b32fb759ec913ae9fc651d97abab9bae918428ac

Contents?: true

Size: 1.42 KB

Versions: 1

Compression:

Stored size: 1.42 KB

Contents

<?php
include "inflector.php";
include "cpt.php";

// If Timber not installed, ignore all the code below this
if (!class_exists("Timber") ) {
  return;
}

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();
  }

  function add_to_context($context) {
    $context["menu"] = new TimberMenu();
    $context["site"] = $this;

    $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;
  }
}

new TimberEdge();

/* REMOVE MENU ITEMS */
add_action("admin_menu", function() {
  $items = get_removed_list();
  global $menu;
  end($menu);

  // var_dump($menu);
  foreach($menu as $key => $m) {
    if($m[0]) {
      $i = explode(" <", $m[0]);

      if(in_array($i[0], $items) ) {
        unset($menu[$key]);
      }
    }
  }
});

/* REMOVE IMAGE RESIZER */
add_filter("intermediate_image_sizes_advanced", function($sizes) {
  unset( $sizes["medium"]);
  unset( $sizes["large"]);

  return $sizes;
});

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
edge_framework-2.1.1 template/wordpress/code/main.php