This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(['angular'], function(angular){ | |
'use strict'; | |
/** | |
* Truncates characters or words. Truncate characters by default does not truncates on a word. | |
*/ | |
angular.module('Filters') | |
.filter('TruncateCharacters', [ | |
function(){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Custom 'orderby' for taxonomies | |
function customtaxorder_applyorderfilter($orderby, $args) { | |
if($args['orderby'] == 'description') | |
return 'tt.description'; | |
else | |
return $orderby; | |
} | |
add_filter('get_terms_orderby', 'customtaxorder_applyorderfilter', 10, 2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Description: Allows you to define a link that is wrapped around widget titles. | |
Author: Justin Hebb - Jukah Digital | |
Based on: Plugin by Dustin Dempsey - Playforward | |
*/ | |
function widget_title_link( $title ) { | |
// assume there's a link attached to the title because it contains a '|' followed by www., http, or / | |
if ( preg_match('/\|(www.|http|\/).*/', $title) ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/********************************************* | |
SIMPLE GRID | |
A very basic semantic Less grid system using padding. | |
Based on Chris Coyier's excellent grid demo at CSS-Tricks : http://css-tricks.com/dont-overthink-it-grids/ | |
********************************************/ | |
// Default grid padding, change to override | |
@gridpad: 2em; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* KNOWN ISSUES | |
- gutter needs to be percentage based | |
- grid containers that don't fit full-width don't clear grid containers below them. May need "clear: both" on grid containers. | |
* TODO | |
- test further | |
- add bottom margin to grid-container? | |
- move margin-bottom to grid-container instead of removing from last-child? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function is_blog () { | |
global $post; | |
$posttype = get_post_type($post ); | |
return ( ( is_archive() || is_home() || is_single() ) && ( $posttype == 'post') ) ? true : false ; | |
} | |
Usage: | |
<?php if (is_blog()) { echo 'You are on a blog page'; } ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$query = new WP_Query(array('post_type' => 'custom-post-type')); | |
while ($query->have_posts()) : $query->the_post(); | |
$terms = get_the_terms( $post->id, 'custom-taxonomy' ); // registered custom taxonomy in custom post type | |
if( $terms && ! is_wp_error( terms ) ) { | |
foreach( $terms as $term ) { | |
echo '<a class="term-' . $term->slug . '" href="' . get_term_link($term) . '" title="' . $term->name .'">' . $term->name .'</a>'; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Is SubPage? | |
* | |
* Checks if the current page is a sub-page and returns true or false. | |
* | |
* @param $page mixed optional ( post_name or ID ) to check against. | |
* @param $single boolean optional - default true to check against all parents, false to check against immediate parent. | |
* @return boolean | |
*/ |