EE: Title plugin

This ExpressionEngine plugin lets you retrieve an entry title quickly and effectively. Instead of the default {exp:weblog:entries}-tag with all its parameters, just use this plugin if you only want to display a title. Very useful for breadcrumbs or document <title>s.

→ Download the Title plugin, version 1.1

By default, the plugin will output a title, formatted with xhtml light (you don’t need that plugin, by the way). In some cases, you can use the custom_field-parameter to display a custom field of your choice instead of the title, which could be useful for multilingual sites. The closing tag is not required.

Entry title

{exp:title:entry}: Get the title for a weblog entry.

Parameters

  • entry_id
  • url_title
  • weblog_id
  • weblog (the short name of a weblog)
  • custom_field (the short name of a custom field)
  • show_error (only in combination with the custom_field parameter, defaults to “no”)

Examples

{exp:title:entry entry_id="15"}
{exp:title:entry url_title="{segment_2}" weblog="default_site"}
{exp:title:entry url_title="{segment_3}" custom_field="title_{language}"}

Category title

{exp:title:category}: Get the category name for a category.

Parameters

  • category_id
  • url_title
  • category_group
  • custom_field (the short name of a custom field)
  • show_error (only in combination with the custom_field parameter, defaults to “no”)

Examples

{exp:title:category category_id="18"}
{exp:title:category category_id="C24"}
{exp:title:category url_title="{segment_4}" category_group="1"}
{exp:title:category url_title="{segment_3}" custom_field="title_{language}"}

As you can see, you can use C24 as input for the category_id parameter. The C will be ignored.

Weblog title

{exp:title:weblog}: Get the title for a weblog.

Parameters

  • weblog_id
  • weblog_name

Examples

{exp:title:weblog weblog_id="3"}
{exp:title:weblog weblog_name="{segment_1}"}

Site title

{exp:title:site}: Get the title for a site.

Parameters

  • site_id
  • site_name

Examples

{exp:title:site site_id="1"}
{exp:title:site site_name="{segment_1}"}

New in version 1.1 – 2007.11.12

  • Added category title
  • Added weblog title
  • Added site title

Comments

  1. author
    1 JMB 21 februari 2008, 01:12

    Will this plugin allow one to enter static <title> tags? I mean, if I have an About Us page I want the title to be very custom for SEO purposes. ie: <title>New York Travel, Vacation in NY, Attend a Broadway Show</title>.

  2. author
    2 Low 21 februari 2008, 01:29

    JMB, this plugin will fetch 1 field from the database, from an entry, category, weblog or site. It will not add any html-tags, including <title> tags.

    You could add a custom field like ‘SEO title’ to your weblog and use that as the page <title>. But if you’re after titles for static pages, why not just hard code them in the templates? Example:

    <title>{if segment_1 == "about-us"}New York Travel, Vacation in NY, Attend a Broadway Show{/if}</title></pre>

  3. author
    3 Jonas Hodge 15 april 2008, 03:17

    Hi Low,

    This looks great. I’m assuming the biggest advantage of this would be to cut down on the resources used to get the same info via weblog:entries. Is that correct?

  4. author
    4 Low 15 april 2008, 09:03

    That’s correct, Jonas. Plus, it’s a lot less to type in.

Leave a comment

Some html (a, em, strong, etc) allowed.


Zoeken in loweblog.com