adi_title – Abbreviate Titles
This plugin will output an abbreviated version of the current article’s title.
adi_title tag
Use <txp:adi_title />
to replace <txp:title />
.
Attributes
separator="string"
specifies the string that delineates the slices. Default = “ “, i.e. a slice = a word.
offset="n"
- if positive, then it defines the number of slices to be skipped at the start of the title.
- if negative, then the sequence will start that far from the end of the title.
Default = 0, i.e. not used.
length="n"
- if specified and positive, then it defines the number of slices to output.
- if specified and negative, then the sequence will stop that many slices from the end of the title.
Default is everything up until the end of the title.
append="string"
specifies a string to be appended to the end of the abbreviated title. Default = “ …”.
wraptag="tag"
- the (X)HTML tag (without ‘<>’ brackets) to wrap around the link. Default = “” (no tag).
class="class name"
- the CSS class to be used on the wraptag. Default = “” (no class).
html_id="id name"
- the HTML ID to be used on the wraptag. Default = “” (no HTML id).
Examples
<txp:adi_title />
- will output the title unchanged
<txp:adi_title length="2" />
- output the first 2 words
e.g. “This title is a bit too long” becomes “This title …”
<txp:adi_title length="-3" />
- remove the last 3 words
e.g. “This title could be chopped at the end” becomes “This title could be chopped …”
<txp:adi_title offset="1" />
- skip the first word
e.g. “The One” becomes “One …”
<txp:adi_title offset="-2" />
- output the last 2 words
e.g. “Not The End” becomes “The End …”
<txp:adi_title length="3" offset="3" />
- skip the first 3 words & output 3 words of what’s left
e.g. “This title has a nice middle bit” becomes “a nice middle …”
<txp:adi_title length="-2" offset="4" />
- skip the first 4 words & output the rest, stopping 2 words from the end
e.g. “The best bit is somewhere near the end” becomes “somewhere near …”
<txp:adi_title length="2" offset="-4" />
- output 2 words, starting 4 from the end
e.g. “Once upon a time, in a land far away” to “a land …”
<txp:adi_title length="-2" offset="-5" />
output words starting 5 from the end & finishing 2 from the end
e.g. “There’re not too many examples listed here” becomes “too many examples …”
<txp:adi_title length="5" append="!" />
output the first 5 words & append exclamation mark
e.g. “I bet you can’t guess what this says” becomes “I bet you can’t guess!”
<txp:adi_title offset="1" append="" separator="-" />
use a hyphen as the separator & skip the first slice
e.g. “Good morning Smithers-Jones” becomes “Jones”
<txp:adi_title offset="1" length="-1" append="ed"/>
remove the first & last words and append a string
e.g. “Lose top and tail please” becomes “top and tailed”
Additional information
Support and further information can be obtained from the Textpattern support forum. A copy of this help is also available online. More adi_plugins can be found here.
adi_titlev0.2Download (Uncompressed) SupportTXP 4.5+
- Plugin list
- adi_article_tab
- adi_calc
- adi_cat_menu
- adi_contact
- adi_detritus
- adi_file_tab
- adi_form_links
- adi_globals
- adi_gps
- adi_if_content
- adi_image_tab
- adi_join
- adi_link
- adi_list
- adi_matrix
- adi_menu
- adi_mobile
- adi_notes
- adi_page_tab
- adi_prefs
- adi_recent_tab
- adi_scripts
- adi_search_db
- adi_title
- adi_variables
- adi_webhook
- adi_wrap