Sha256: 8df237d3839661bfc1b62d76df1b0aee561e84b48445c44a5531938b3d8462b3

Contents?: true

Size: 1.5 KB

Versions: 2

Compression:

Stored size: 1.5 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 */
function h_remove_menu() {
  $items = get_removed_list();
  global $menu;
  end($menu);
  while(prev($menu) ) {
    $item = explode(" ", $menu[key($menu)][0]);
    $item_first = $item[0] != NULL ? $item[0] : "";
    if(in_array($item_first, $items) ) {
      unset($menu[key($menu)]);
    }
  }
}
add_action("admin_menu", "h_remove_menu");

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

  return $sizes;
}
add_filter("intermediate_image_sizes_advanced", "h_remove_resizer");

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
edge_framework-2.1.0 template/wordpress/code/main.php
edge_framework-2.0.0 template/wordpress/code/main.php