Navigation Menu

Skip to content

rkingon/Craft-Plugin--Trimmer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Trimmer for Craft

A smart trimming / truncating plugin for Craft.

##Params

  1. Length: The character count you want to display
  2. Word: If you want the plugin to backtrack to the nearest full word, defaults to true.
  3. Ellipsis: Appended to the end of the string, defaults to: "..."

Usage

####As a Filter {{ entry.body | trimit(100) }}

####As a Function {{ trimit(entry.body, 100) }}

Examples

No Ellipsis

{{ entry.body | trimit(100, true, "") }}

Truncate by char's

{{ entry.body | trimit(100, false, "") }}

{{ entry.body | trimit(100, "no", "") }}

{{ entry.body | trimit(100, "false", "") }}

Multiple variables or a combination of strings

{% filter trimit(100) %}
    {{ someVar }} {{ someOtherVar }}
{% endfilter %}

##Notes

  • HTML Tags are always removed.
  • If the length of your string is less than the length defined then the plugin will return the full string with out html tags & no ellipsis.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages