template/wordpress/functions.php in edge_framework-0.10.0 vs template/wordpress/functions.php in edge_framework-1.0.0

- old
+ new

@@ -1,62 +1,24 @@ -<?php -/* ------------------------------------ -EDGE Press v0.1 -- Extend functionality to Word Press ---------------------------------------- */ +<?php include "code/main.php"; +// THEME SUPPORT add_theme_support("post-thumbnails"); +add_theme_support("menus"); -function root() { - return get_template_directory_uri()."/"; -} - -/* -Echo path to assets directory - @return = relative path to specified assets directory +/* CUSTOM POST TYPE + 1: Type name, MUST be singular + 2: (opt) Icon name, check http://melchoyce.github.io/dashicons/ + 3: (opt) Taxonomy name, MUST be singular */ -function home() { echo home_url()."/"; } -function img() { echo root()."assets/img/"; } -function css() { echo root()."assets/css/"; } -function js() { echo root()."assets/js/"; } -function files() { echo root()."assets/files/"; } +add_post_type("Product", "cart", "Brand"); // Sample +// Allow the use of Product::find() +class Product extends Post {}; -/* - Ellipsize the text (Adding "..." at the end of the word) - Always stop at the end of a word. - @param text = The statement to be ellipsized - char_number = Number of characters before adding the ellipse - etc = The ellipse text to be added, default to "..." - @return = the ellipsed text +/* Remove Unnecessary ADMIN SIDEBAR + - Use the slug */ -function ellipsize($text, $char_number, $etc = "...") { - $text = html_entity_decode($text, ENT_QUOTES); - if (strlen($text) > $char_number) { - $text = substr($text, 0, $char_number); - $text = substr($text,0,strrpos($text," ")); - - $punctuation = ".!?:;,-"; // punctuation you want removed - - $text = (strspn(strrev($text), $punctuation) != 0) - ? - substr($text, 0, -strspn(strrev($text), $punctuation)) - : - $text; - - $text = $text.$etc; - } - $text = htmlentities($text, ENT_QUOTES); - return $text; -} - -/* - Automatically use "single-{category_slug}.php" as post template for that category - Example: - "single-product.php" is used as template for post with category "product" -*/ -add_filter("single_template", create_function( - '$the_template', - 'foreach( (array) get_the_category() as $cat ) { - if ( file_exists(TEMPLATEPATH . "/single-{$cat->slug}.php") ) - return TEMPLATEPATH . "/single-{$cat->slug}.php"; } - return $the_template;' ) -); +function remove_menu_items() { + $items = array( + "upload.php", + ); + foreach($items as $item) { remove_menu_page($item); } +} \ No newline at end of file