Sha256: 49169e72476d0b089e6d3234df985934f36ef6fc0b1454246a6dd32b25ef7016
Contents?: true
Size: 1.92 KB
Versions: 1
Compression:
Stored size: 1.92 KB
Contents
<?php /* ------------------------------------ EDGE Press v0.1 - Extend functionality to Word Press --------------------------------------- */ add_theme_support("post-thumbnails"); function root() { return get_template_directory_uri()."/"; } /* Echo path to assets directory @return = relative path to specified assets directory */ 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/"; } /* 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 */ 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;' ) );
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
edge_framework-0.10.0 | template/wordpress/functions.php |